From owner-svn-src-head@FreeBSD.ORG Sun Oct 12 00:44:28 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 52B2C1065687; Sun, 12 Oct 2008 00:44:28 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3C4728FC0A; Sun, 12 Oct 2008 00:44:28 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9C0iSQp031023; Sun, 12 Oct 2008 00:44:28 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9C0iRUt031013; Sun, 12 Oct 2008 00:44:27 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200810120044.m9C0iRUt031013@svn.freebsd.org> From: Xin LI Date: Sun, 12 Oct 2008 00:44:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183770 - head/usr.sbin/nscd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Oct 2008 00:44:28 -0000 Author: delphij Date: Sun Oct 12 00:44:27 2008 New Revision: 183770 URL: http://svn.freebsd.org/changeset/base/183770 Log: Reduce code duplication: use calloc instead of allocing and memset afterward. Approved by: bushman Modified: head/usr.sbin/nscd/agent.c head/usr.sbin/nscd/cachelib.c head/usr.sbin/nscd/cacheplcs.c head/usr.sbin/nscd/config.c head/usr.sbin/nscd/hashtable.h head/usr.sbin/nscd/mp_rs_query.c head/usr.sbin/nscd/mp_ws_query.c head/usr.sbin/nscd/nscd.c head/usr.sbin/nscd/nscdcli.c head/usr.sbin/nscd/query.c Modified: head/usr.sbin/nscd/agent.c ============================================================================== --- head/usr.sbin/nscd/agent.c Sat Oct 11 21:59:03 2008 (r183769) +++ head/usr.sbin/nscd/agent.c Sun Oct 12 00:44:27 2008 (r183770) @@ -60,9 +60,8 @@ init_agent_table() struct agent_table *retval; TRACE_IN(init_agent_table); - retval = (struct agent_table *)malloc(sizeof(struct agent_table)); + retval = (struct agent_table *)calloc(1, sizeof(struct agent_table)); assert(retval != NULL); - memset(retval, 0, sizeof(struct agent_table)); TRACE_OUT(init_agent_table); return (retval); Modified: head/usr.sbin/nscd/cachelib.c ============================================================================== --- head/usr.sbin/nscd/cachelib.c Sat Oct 11 21:59:03 2008 (r183769) +++ head/usr.sbin/nscd/cachelib.c Sun Oct 12 00:44:27 2008 (r183770) @@ -479,18 +479,15 @@ init_cache(struct cache_params const *pa TRACE_IN(init_cache); assert(params != NULL); - retval = (struct cache_ *)malloc(sizeof(struct cache_)); + retval = (struct cache_ *)calloc(1, sizeof(struct cache_)); assert(retval != NULL); - memset(retval, 0, sizeof(struct cache_)); assert(params != NULL); memcpy(&retval->params, params, sizeof(struct cache_params)); - retval->entries = (struct cache_entry_ **)malloc( + retval->entries = (struct cache_entry_ **)calloc(1, sizeof(struct cache_entry_ *) * INITIAL_ENTRIES_CAPACITY); assert(retval->entries != NULL); - memset(retval->entries, 0, sizeof(sizeof(struct cache_entry_ *) - * INITIAL_ENTRIES_CAPACITY)); retval->entries_capacity = INITIAL_ENTRIES_CAPACITY; retval->entries_size = 0; @@ -541,12 +538,10 @@ register_cache_entry(struct cache_ *the_ new_capacity = the_cache->entries_capacity + ENTRIES_CAPACITY_STEP; - new_entries = (struct cache_entry_ **)malloc( + new_entries = (struct cache_entry_ **)calloc(1, sizeof(struct cache_entry_ *) * new_capacity); assert(new_entries != NULL); - memset(new_entries, 0, sizeof(struct cache_entry_ *) * - new_capacity); memcpy(new_entries, the_cache->entries, sizeof(struct cache_entry_ *) * the_cache->entries_size); @@ -559,21 +554,18 @@ register_cache_entry(struct cache_ *the_ switch (params->entry_type) { case CET_COMMON: - new_common_entry = (struct cache_common_entry_ *)malloc( + new_common_entry = (struct cache_common_entry_ *)calloc(1, sizeof(struct cache_common_entry_)); assert(new_common_entry != NULL); - memset(new_common_entry, 0, sizeof(struct cache_common_entry_)); memcpy(&new_common_entry->common_params, params, sizeof(struct common_cache_entry_params)); new_common_entry->params = (struct cache_entry_params *)&new_common_entry->common_params; - new_common_entry->common_params.entry_name = (char *)malloc( + new_common_entry->common_params.entry_name = (char *)calloc(1, entry_name_size+1); assert(new_common_entry->common_params.entry_name != NULL); - memset(new_common_entry->common_params.entry_name, 0, - entry_name_size + 1); strncpy(new_common_entry->common_params.entry_name, params->entry_name, entry_name_size); new_common_entry->name = @@ -588,11 +580,9 @@ register_cache_entry(struct cache_ *the_ else policies_size = 2; - new_common_entry->policies = (struct cache_policy_ **)malloc( + new_common_entry->policies = (struct cache_policy_ **)calloc(1, sizeof(struct cache_policy_ *) * policies_size); assert(new_common_entry->policies != NULL); - memset(new_common_entry->policies, 0, - sizeof(struct cache_policy_ *) * policies_size); new_common_entry->policies_size = policies_size; new_common_entry->policies[0] = init_cache_fifo_policy(); @@ -618,21 +608,18 @@ register_cache_entry(struct cache_ *the_ (struct cache_entry_ *)new_common_entry; break; case CET_MULTIPART: - new_mp_entry = (struct cache_mp_entry_ *)malloc( + new_mp_entry = (struct cache_mp_entry_ *)calloc(1, sizeof(struct cache_mp_entry_)); assert(new_mp_entry != NULL); - memset(new_mp_entry, 0, sizeof(struct cache_mp_entry_)); memcpy(&new_mp_entry->mp_params, params, sizeof(struct mp_cache_entry_params)); new_mp_entry->params = (struct cache_entry_params *)&new_mp_entry->mp_params; - new_mp_entry->mp_params.entry_name = (char *)malloc( + new_mp_entry->mp_params.entry_name = (char *)calloc(1, entry_name_size+1); assert(new_mp_entry->mp_params.entry_name != NULL); - memset(new_mp_entry->mp_params.entry_name, 0, - entry_name_size + 1); strncpy(new_mp_entry->mp_params.entry_name, params->entry_name, entry_name_size); new_mp_entry->name = new_mp_entry->mp_params.entry_name; @@ -925,10 +912,9 @@ open_cache_mp_write_session(struct cache return (NULL); } - retval = (struct cache_mp_write_session_ *)malloc( + retval = (struct cache_mp_write_session_ *)calloc(1, sizeof(struct cache_mp_write_session_)); assert(retval != NULL); - memset(retval, 0, sizeof(struct cache_mp_write_session_)); TAILQ_INIT(&retval->items); retval->parent_entry = mp_entry; @@ -961,10 +947,9 @@ cache_mp_write(struct cache_mp_write_ses return (-1); } - new_item = (struct cache_mp_data_item_ *)malloc( + new_item = (struct cache_mp_data_item_ *)calloc(1, sizeof(struct cache_mp_data_item_)); assert(new_item != NULL); - memset(new_item, 0, sizeof(struct cache_mp_data_item_)); new_item->value = (char *)malloc(data_size); assert(new_item->value != NULL); @@ -1065,10 +1050,9 @@ open_cache_mp_read_session(struct cache_ } } - retval = (struct cache_mp_read_session_ *)malloc( + retval = (struct cache_mp_read_session_ *)calloc(1, sizeof(struct cache_mp_read_session_)); assert(retval != NULL); - memset(retval, 0, sizeof(struct cache_mp_read_session_)); retval->parent_entry = mp_entry; retval->current_item = TAILQ_FIRST( Modified: head/usr.sbin/nscd/cacheplcs.c ============================================================================== --- head/usr.sbin/nscd/cacheplcs.c Sat Oct 11 21:59:03 2008 (r183769) +++ head/usr.sbin/nscd/cacheplcs.c Sun Oct 12 00:44:27 2008 (r183770) @@ -82,10 +82,9 @@ cache_queue_policy_create_item() struct cache_queue_policy_item_ *retval; TRACE_IN(cache_queue_policy_create_item); - retval = (struct cache_queue_policy_item_ *)malloc( + retval = (struct cache_queue_policy_item_ *)calloc(1, sizeof(struct cache_queue_policy_item_)); assert(retval != NULL); - memset(retval, 0, sizeof(struct cache_queue_policy_item_)); TRACE_OUT(cache_queue_policy_create_item); return ((struct cache_policy_item_ *)retval); @@ -193,10 +192,9 @@ init_cache_queue_policy(void) struct cache_queue_policy_ *retval; TRACE_IN(init_cache_queue_policy); - retval = (struct cache_queue_policy_ *)malloc( + retval = (struct cache_queue_policy_ *)calloc(1, sizeof(struct cache_queue_policy_)); assert(retval != NULL); - memset(retval, 0, sizeof(struct cache_queue_policy_)); retval->parent_data.create_item_func = cache_queue_policy_create_item; retval->parent_data.destroy_item_func = cache_queue_policy_destroy_item; @@ -334,10 +332,9 @@ cache_lfu_policy_create_item(void) struct cache_lfu_policy_item_ *retval; TRACE_IN(cache_lfu_policy_create_item); - retval = (struct cache_lfu_policy_item_ *)malloc( + retval = (struct cache_lfu_policy_item_ *)calloc(1, sizeof(struct cache_lfu_policy_item_)); assert(retval != NULL); - memset(retval, 0, sizeof(struct cache_lfu_policy_item_)); TRACE_OUT(cache_lfu_policy_create_item); return ((struct cache_policy_item_ *)retval); @@ -539,10 +536,9 @@ init_cache_lfu_policy() struct cache_lfu_policy_ *retval; TRACE_IN(init_cache_lfu_policy); - retval = (struct cache_lfu_policy_ *)malloc( + retval = (struct cache_lfu_policy_ *)calloc(1, sizeof(struct cache_lfu_policy_)); assert(retval != NULL); - memset(retval, 0, sizeof(struct cache_lfu_policy_)); retval->parent_data.create_item_func = cache_lfu_policy_create_item; retval->parent_data.destroy_item_func = cache_lfu_policy_destroy_item; Modified: head/usr.sbin/nscd/config.c ============================================================================== --- head/usr.sbin/nscd/config.c Sat Oct 11 21:59:03 2008 (r183769) +++ head/usr.sbin/nscd/config.c Sun Oct 12 00:44:27 2008 (r183770) @@ -119,10 +119,9 @@ create_configuration_entry(const char *n assert(negative_params != NULL); assert(mp_params != NULL); - retval = (struct configuration_entry *)malloc( + retval = (struct configuration_entry *)calloc(1, sizeof(struct configuration_entry)); assert(retval != NULL); - memset(retval, 0, sizeof(struct configuration_entry)); res = pthread_mutex_init(&retval->positive_cache_lock, NULL); if (res != 0) { @@ -162,9 +161,8 @@ create_configuration_entry(const char *n sizeof(struct mp_cache_entry_params)); size = strlen(name); - retval->name = (char *)malloc(size + 1); + retval->name = (char *)calloc(1, size + 1); assert(retval->name != NULL); - memset(retval->name, 0, size + 1); memcpy(retval->name, name, size); memcpy(&retval->common_query_timeout, common_timeout, @@ -268,12 +266,10 @@ add_configuration_entry(struct configura struct configuration_entry **new_entries; config->entries_capacity *= 2; - new_entries = (struct configuration_entry **)malloc( + new_entries = (struct configuration_entry **)calloc(1, sizeof(struct configuration_entry *) * config->entries_capacity); assert(new_entries != NULL); - memset(new_entries, 0, sizeof(struct configuration_entry *) * - config->entries_capacity); memcpy(new_entries, config->entries, sizeof(struct configuration_entry *) * config->entries_size); @@ -514,17 +510,14 @@ init_configuration(void) struct configuration *retval; TRACE_IN(init_configuration); - retval = (struct configuration *)malloc(sizeof(struct configuration)); + retval = (struct configuration *)calloc(1, sizeof(struct configuration)); assert(retval != NULL); - memset(retval, 0, sizeof(struct configuration)); retval->entries_capacity = INITIAL_ENTRIES_CAPACITY; - retval->entries = (struct configuration_entry **)malloc( + retval->entries = (struct configuration_entry **)calloc(1, sizeof(struct configuration_entry *) * retval->entries_capacity); assert(retval->entries != NULL); - memset(retval->entries, 0, sizeof(struct configuration_entry *) * - retval->entries_capacity); pthread_rwlock_init(&retval->rwlock, NULL); @@ -544,15 +537,13 @@ fill_configuration_defaults(struct confi free(config->socket_path); len = strlen(DEFAULT_SOCKET_PATH); - config->socket_path = (char *)malloc(len + 1); + config->socket_path = (char *)calloc(1, len + 1); assert(config->socket_path != NULL); - memset(config->socket_path, 0, len + 1); memcpy(config->socket_path, DEFAULT_SOCKET_PATH, len); len = strlen(DEFAULT_PIDFILE_PATH); - config->pidfile_path = (char *)malloc(len + 1); + config->pidfile_path = (char *)calloc(1, len + 1); assert(config->pidfile_path != NULL); - memset(config->pidfile_path, 0, len + 1); memcpy(config->pidfile_path, DEFAULT_PIDFILE_PATH, len); config->socket_mode = S_IFSOCK | S_IRUSR | S_IWUSR | Modified: head/usr.sbin/nscd/hashtable.h ============================================================================== --- head/usr.sbin/nscd/hashtable.h Sat Oct 11 21:59:03 2008 (r183769) +++ head/usr.sbin/nscd/hashtable.h Sun Oct 12 00:44:27 2008 (r183770) @@ -75,9 +75,7 @@ typedef int hashtable_index_t; #define HASHTABLE_INIT(table, type, field, _entries_size) \ do { \ hashtable_index_t var; \ - (table)->entries = (void *)malloc( \ - sizeof(*(table)->entries) * (_entries_size)); \ - memset((table)->entries, 0, \ + (table)->entries = (void *)calloc(1, \ sizeof(*(table)->entries) * (_entries_size)); \ (table)->entries_size = (_entries_size); \ for (var = 0; var < HASHTABLE_ENTRIES_COUNT(table); ++var) {\ Modified: head/usr.sbin/nscd/mp_rs_query.c ============================================================================== --- head/usr.sbin/nscd/mp_rs_query.c Sat Oct 11 21:59:03 2008 (r183769) +++ head/usr.sbin/nscd/mp_rs_query.c Sun Oct 12 00:44:27 2008 (r183770) @@ -115,11 +115,9 @@ on_mp_read_session_request_read1(struct return (-1); } - c_mp_rs_request->entry = (char *)malloc( + c_mp_rs_request->entry = (char *)calloc(1, c_mp_rs_request->entry_length + 1); assert(c_mp_rs_request->entry != NULL); - memset(c_mp_rs_request->entry, 0, - c_mp_rs_request->entry_length + 1); qstate->kevent_watermark = c_mp_rs_request->entry_length; qstate->process_func = on_mp_read_session_request_read2; Modified: head/usr.sbin/nscd/mp_ws_query.c ============================================================================== --- head/usr.sbin/nscd/mp_ws_query.c Sat Oct 11 21:59:03 2008 (r183769) +++ head/usr.sbin/nscd/mp_ws_query.c Sun Oct 12 00:44:27 2008 (r183770) @@ -121,11 +121,9 @@ on_mp_write_session_request_read1(struct return (-1); } - c_mp_ws_request->entry = (char *)malloc( + c_mp_ws_request->entry = (char *)calloc(1, c_mp_ws_request->entry_length + 1); assert(c_mp_ws_request->entry != NULL); - memset(c_mp_ws_request->entry, 0, - c_mp_ws_request->entry_length + 1); qstate->kevent_watermark = c_mp_ws_request->entry_length; qstate->process_func = on_mp_write_session_request_read2; @@ -376,9 +374,8 @@ on_mp_write_session_write_request_read1( return (-1); } - write_request->data = (char *)malloc(write_request->data_size); + write_request->data = (char *)calloc(1, write_request->data_size); assert(write_request->data != NULL); - memset(write_request->data, 0, write_request->data_size); qstate->kevent_watermark = write_request->data_size; qstate->process_func = on_mp_write_session_write_request_read2; Modified: head/usr.sbin/nscd/nscd.c ============================================================================== --- head/usr.sbin/nscd/nscd.c Sat Oct 11 21:59:03 2008 (r183769) +++ head/usr.sbin/nscd/nscd.c Sun Oct 12 00:44:27 2008 (r183770) @@ -163,9 +163,8 @@ init_runtime_env(struct configuration *c struct runtime_env *retval; TRACE_IN(init_runtime_env); - retval = (struct runtime_env *)malloc(sizeof(struct runtime_env)); + retval = (struct runtime_env *)calloc(1, sizeof(struct runtime_env)); assert(retval != NULL); - memset(retval, 0, sizeof(struct runtime_env)); retval->sockfd = socket(PF_LOCAL, SOCK_STREAM, 0); @@ -408,10 +407,9 @@ process_socket_event(struct kevent *even if (qstate->io_buffer != NULL) free(qstate->io_buffer); - qstate->io_buffer = (char *)malloc( + qstate->io_buffer = (char *)calloc(1, qstate->kevent_watermark); assert(qstate->io_buffer != NULL); - memset(qstate->io_buffer, 0, qstate->kevent_watermark); qstate->io_buffer_p = qstate->io_buffer; qstate->io_buffer_size = qstate->kevent_watermark; @@ -829,10 +827,8 @@ main(int argc, char *argv[]) } if (s_configuration->threads_num > 1) { - threads = (pthread_t *)malloc(sizeof(pthread_t) * + threads = (pthread_t *)calloc(1, sizeof(pthread_t) * s_configuration->threads_num); - memset(threads, 0, sizeof(pthread_t) * - s_configuration->threads_num); for (i = 0; i < s_configuration->threads_num; ++i) { thread_args = (struct processing_thread_args *)malloc( sizeof(struct processing_thread_args)); Modified: head/usr.sbin/nscd/nscdcli.c ============================================================================== --- head/usr.sbin/nscd/nscdcli.c Sat Oct 11 21:59:03 2008 (r183769) +++ head/usr.sbin/nscd/nscdcli.c Sun Oct 12 00:44:27 2008 (r183770) @@ -201,9 +201,8 @@ open_nscd_connection__(struct nscd_conne } fcntl(client_socket, F_SETFL, O_NONBLOCK); - retval = malloc(sizeof(struct nscd_connection_)); + retval = calloc(1, sizeof(struct nscd_connection_)); assert(retval != NULL); - memset(retval, 0, sizeof(struct nscd_connection_)); retval->sockfd = client_socket; Modified: head/usr.sbin/nscd/query.c ============================================================================== --- head/usr.sbin/nscd/query.c Sat Oct 11 21:59:03 2008 (r183769) +++ head/usr.sbin/nscd/query.c Sun Oct 12 00:44:27 2008 (r183770) @@ -332,27 +332,21 @@ on_write_request_read1(struct query_stat return (-1); } - write_request->entry = (char *)malloc( + write_request->entry = (char *)calloc(1, write_request->entry_length + 1); assert(write_request->entry != NULL); - memset(write_request->entry, 0, - write_request->entry_length + 1); - write_request->cache_key = (char *)malloc( + write_request->cache_key = (char *)calloc(1, write_request->cache_key_size + qstate->eid_str_length); assert(write_request->cache_key != NULL); memcpy(write_request->cache_key, qstate->eid_str, qstate->eid_str_length); - memset(write_request->cache_key + qstate->eid_str_length, 0, - write_request->cache_key_size); if (write_request->data_size != 0) { - write_request->data = (char *)malloc( + write_request->data = (char *)calloc(1, write_request->data_size); assert(write_request->data != NULL); - memset(write_request->data, 0, - write_request->data_size); } qstate->kevent_watermark = write_request->entry_length + @@ -611,19 +605,16 @@ on_read_request_read1(struct query_state return (-1); } - read_request->entry = (char *)malloc( + read_request->entry = (char *)calloc(1, read_request->entry_length + 1); assert(read_request->entry != NULL); - memset(read_request->entry, 0, read_request->entry_length + 1); - read_request->cache_key = (char *)malloc( + read_request->cache_key = (char *)calloc(1, read_request->cache_key_size + qstate->eid_str_length); assert(read_request->cache_key != NULL); memcpy(read_request->cache_key, qstate->eid_str, qstate->eid_str_length); - memset(read_request->cache_key + qstate->eid_str_length, 0, - read_request->cache_key_size); qstate->kevent_watermark = read_request->entry_length + read_request->cache_key_size; @@ -936,11 +927,9 @@ on_transform_request_read1(struct query_ return (-1); } - transform_request->entry = (char *)malloc( + transform_request->entry = (char *)calloc(1, transform_request->entry_length + 1); assert(transform_request->entry != NULL); - memset(transform_request->entry, 0, - transform_request->entry_length + 1); qstate->process_func = on_transform_request_read2; } else @@ -1228,9 +1217,8 @@ init_query_state(int sockfd, size_t keve struct query_state *retval; TRACE_IN(init_query_state); - retval = (struct query_state *)malloc(sizeof(struct query_state)); + retval = (struct query_state *)calloc(1, sizeof(struct query_state)); assert(retval != NULL); - memset(retval, 0, sizeof(struct query_state)); retval->sockfd = sockfd; retval->kevent_filter = EVFILT_READ; From owner-svn-src-head@FreeBSD.ORG Sun Oct 12 02:31:09 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AD2C51065687; Sun, 12 Oct 2008 02:31:09 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9B1D38FC0C; Sun, 12 Oct 2008 02:31:09 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9C2V9mf032809; Sun, 12 Oct 2008 02:31:09 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9C2V9hc032807; Sun, 12 Oct 2008 02:31:09 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200810120231.m9C2V9hc032807@svn.freebsd.org> From: Warner Losh Date: Sun, 12 Oct 2008 02:31:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183771 - head/sys/mips/mips X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Oct 2008 02:31:09 -0000 Author: imp Date: Sun Oct 12 02:31:09 2008 New Revision: 183771 URL: http://svn.freebsd.org/changeset/base/183771 Log: opt_msgbuf.h is needed for MSGBUF_SIZE overrides, if any. Submitted by: alc@ Modified: head/sys/mips/mips/machdep.c head/sys/mips/mips/pmap.c Modified: head/sys/mips/mips/machdep.c ============================================================================== --- head/sys/mips/mips/machdep.c Sun Oct 12 00:44:27 2008 (r183770) +++ head/sys/mips/mips/machdep.c Sun Oct 12 02:31:09 2008 (r183771) @@ -42,8 +42,9 @@ #include __FBSDID("$FreeBSD$"); -#include "opt_md.h" #include "opt_ddb.h" +#include "opt_md.h" +#include "opt_msgbuf.h" #include #include Modified: head/sys/mips/mips/pmap.c ============================================================================== --- head/sys/mips/mips/pmap.c Sun Oct 12 00:44:27 2008 (r183770) +++ head/sys/mips/mips/pmap.c Sun Oct 12 02:31:09 2008 (r183771) @@ -69,6 +69,7 @@ __FBSDID("$FreeBSD$"); #include "opt_ddb.h" +#include "opt_msgbuf.h" #include #include #include From owner-svn-src-head@FreeBSD.ORG Sun Oct 12 02:52:57 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 48D361065699; Sun, 12 Oct 2008 02:52:57 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 364A78FC0C; Sun, 12 Oct 2008 02:52:57 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9C2qvNx033191; Sun, 12 Oct 2008 02:52:57 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9C2qvr9033190; Sun, 12 Oct 2008 02:52:57 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <200810120252.m9C2qvr9033190@svn.freebsd.org> From: Ken Smith Date: Sun, 12 Oct 2008 02:52:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183772 - head/release X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Oct 2008 02:52:57 -0000 Author: kensmith Date: Sun Oct 12 02:52:56 2008 New Revision: 183772 URL: http://svn.freebsd.org/changeset/base/183772 Log: Add a build knob MAKE_DVD to control on a per-architecture basis whether or not to build a tree used for the creation of a DVD image. If that is enabled set up a DVD tree by installing everything we normally install to the individual CDROM trees into the one DVD tree. The result is one image with all the install bits, livefs bits, and doc bits suitable for burning to a DVD instead of CDROM. Enable building the DVD for amd64 and i386. MFC after: 1 week Modified: head/release/Makefile Modified: head/release/Makefile ============================================================================== --- head/release/Makefile Sun Oct 12 02:31:09 2008 (r183771) +++ head/release/Makefile Sun Oct 12 02:52:56 2008 (r183772) @@ -192,6 +192,7 @@ MNT= /mnt .undef MAKE_FLOPPIES .if ${TARGET_ARCH} == "i386" MAKE_FLOPPIES= true +MAKE_DVD= SEPARATE_LIVEFS= SPLIT_MFSROOT= .if ${TARGET} == "pc98" @@ -222,6 +223,7 @@ MFSLABEL= auto SEPARATE_LIVEFS= .elif ${TARGET_ARCH} == "amd64" MAKE_FLOPPIES= true +MAKE_DVD= FLOPPYSIZE= 1440 FLOPPYSPLITSIZE= 1392 FLOPPYINODE= 40000 @@ -262,6 +264,9 @@ CD= ${_R}/cdrom CD_BOOT= ${CD}/bootonly CD_DISC1= ${CD}/disc1 CD_DISC2= ${CD}/disc2 +.if defined(MAKE_DVD) +CD_DVD= ${CD}/dvd +.endif .if !defined(NODOC) CD_DOCS= ${CD}/docs .endif @@ -480,6 +485,7 @@ release rerelease: KERNELS \ KERNELS_BASE \ KERNEL_FLAGS \ + MAKE_DVD \ MAKE_FLOPPIES \ MAKE_ISOS \ NOCDROM \ @@ -922,6 +928,18 @@ cdrom.1: find . -depth -print | cpio -dumpl ${CD_LIVEFS} ) ; \ fi \ done +.if defined(MAKE_DVD) + @echo "Building DVD filesystem image as well as CDROM" + @mkdir -p ${CD_DVD}/${BUILDNAME} + @for i in ${DISTRIBUTIONS} ; \ + do \ + if [ -d ${RD}/trees/$${i} ] ; then \ + chflags -R noschg ${RD}/trees/$${i} || true ; \ + ( cd ${RD}/trees/$${i} && \ + find . -depth -print | cpio -dumpl ${CD_DVD} ) ; \ + fi \ + done +.endif @echo "Copy GENERIC kernel to boot area" @cp -Rp ${RD}/kernels/GENERIC/ ${CD_LIVEFS}/boot/kernel @rm -f ${CD_LIVEFS}/boot/kernel/*.symbols @@ -939,7 +957,24 @@ cdrom.1: @rm -f ${CD_LIVEFS}/boot/device.hints @cp ${RD}/trees/base/boot/device.hints ${CD_LIVEFS}/boot/device.hints .endif +.if defined(MAKE_DVD) + @cp -Rp ${RD}/kernels/GENERIC/ ${CD_DVD}/boot/kernel + @rm -f ${CD_DVD}/boot/kernel/*.symbols + @rm -f ${CD_DVD}/.profile + @cp ${.CURDIR}/fixit.profile ${CD_DVD}/.profile + @ln -sf /rescue ${CD_DVD}/stand @echo "CD_VERSION = ${BUILDNAME}" > ${CD_LIVEFS}/cdrom.inf + @echo "CD_VERSION = ${BUILDNAME}" > ${CD_DVD}/cdrom.inf + @rm -f ${CD_DVD}/boot/loader.conf + @cp ${RD}/mfsroot/mfsroot.gz ${CD_DVD}/boot/mfsroot.gz + @echo 'mfsroot_load="YES"' > ${CD_DVD}/boot/loader.conf + @echo 'mfsroot_type="mfs_root"' >> ${CD_DVD}/boot/loader.conf + @echo 'mfsroot_name="/boot/mfsroot"' >> ${CD_DVD}/boot/loader.conf +.if exists(${RD}/trees/base/boot/device.hints) + @rm -f ${CD_DVD}/boot/device.hints + @cp ${RD}/trees/base/boot/device.hints ${CD_DVD}/boot/device.hints +.endif +.endif touch ${.TARGET} # Build disc1 and disc2 cdrom images @@ -974,11 +1009,37 @@ cdrom.2: @mkdir -p ${CD_DISC2} @echo "CD_VERSION = ${BUILDNAME}" > ${CD_DISC2}/cdrom.inf @echo "CD_VOLUME = 2" >> ${CD_DISC2}/cdrom.inf +.if defined(MAKE_DVD) +.if defined(MAKE_FLOPPIES) + @cd ${RD} && find floppies -print | cpio -dumpl ${CD_DVD} +.endif + @cd ${RD}/dists && find . -print | cpio -dumpl ${CD_DVD}/${BUILDNAME} +.if !defined(NODOC) + @for i in ${DIST_DOCS_ARCH_INDEP}; do \ + cp ${RND}/${RELNOTES_LANG}/$$i/article.txt \ + ${CD_DVD}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \ + cp ${RND}/${RELNOTES_LANG}/$$i/article.html \ + ${CD_DVD}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \ + done + @for i in ${DIST_DOCS_ARCH_DEP}; do \ + cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.txt \ + ${CD_DVD}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \ + cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.html \ + ${CD_DVD}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \ + done + @cp ${RND}/${RELNOTES_LANG}/readme/docbook.css ${CD_DVD} +.endif + @echo "CD_VERSION = ${BUILDNAME}" > ${CD_DVD}/cdrom.inf + @echo "CD_VOLUME = 1" >> ${CD_DVD}/cdrom.inf +.endif .if !defined(NODOC) echo "Building CDROM docs filesystem image" @mkdir -p ${CD_DOCS} @echo "CD_VERSION = ${BUILDNAME}" > ${CD_DOCS}/cdrom.inf @mkdir -p ${CD_DOCS}/usr/share/doc +.if defined(MAKE_DVD) + @mkdir -p ${CD_DVD}/usr/share/doc +.endif @for i in `ls ${CD_LIVEFS}/usr/share/doc`; do \ if [ -L ${CD_LIVEFS}/usr/share/doc/$$i -o \ -d /usr/doc/$$i ]; then \ @@ -986,6 +1047,10 @@ cdrom.2: ${CD_DOCS}/usr/share/doc; \ fi \ done +.if defined(MAKE_DVD) + @cd ${CD_DOCS}/usr/share/doc && find . -print | \ + cpio -dumpl ${CD_DVD}/usr/share/doc +.endif .endif touch ${.TARGET} @@ -1016,6 +1081,9 @@ CD_DISC1_PKGS= ${CD_PACKAGE_TREE}/disc1 .if exists(${CD_PACKAGE_TREE}/disc2) CD_DISC2_PKGS= ${CD_PACKAGE_TREE}/disc2 .endif +.if exists(${CD_PACKAGE_TREE}/dvd) +CD_DVD_PKGS= ${CD_PACKAGE_TREE}/dvd +.endif .endif .endif @@ -1035,6 +1103,12 @@ iso.1: FreeBSD_Packages \ ${CD}/${BUILDNAME}-${TARGET}-disc2.iso ${CD_DISC2} \ ${CD_DISC2_PKGS} +.if defined(MAKE_DVD) + @sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \ + FreeBSD_Install \ + ${CD}/${BUILDNAME}-${TARGET}-dvd.iso ${CD_DVD} \ + ${CD_DVD_PKGS} +.endif .if !defined(NODOC) @sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh \ FreeBSD_Documentation \ From owner-svn-src-head@FreeBSD.ORG Sun Oct 12 06:58:03 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F16681065695; Sun, 12 Oct 2008 06:58:03 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E008C8FC13; Sun, 12 Oct 2008 06:58:03 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9C6w3ub037536; Sun, 12 Oct 2008 06:58:03 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9C6w3XK037535; Sun, 12 Oct 2008 06:58:03 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200810120658.m9C6w3XK037535@svn.freebsd.org> From: Warner Losh Date: Sun, 12 Oct 2008 06:58:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183773 - head/etc/etc.mips X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Oct 2008 06:58:04 -0000 Author: imp Date: Sun Oct 12 06:58:03 2008 New Revision: 183773 URL: http://svn.freebsd.org/changeset/base/183773 Log: Add entries for uart based serial ports. All the serial ports on mips so far are uart subclasses. Also, turn uart0 on by default. Modified: head/etc/etc.mips/ttys Modified: head/etc/etc.mips/ttys ============================================================================== --- head/etc/etc.mips/ttys Sun Oct 12 02:52:56 2008 (r183772) +++ head/etc/etc.mips/ttys Sun Oct 12 06:58:03 2008 (r183773) @@ -33,10 +33,10 @@ console none unknown off secure # Serial terminals # The 'dialup' keyword identifies dialin lines to login, fingerd etc. -ttyU0 "/usr/libexec/getty std.9600" dialup off secure -ttyU1 "/usr/libexec/getty std.9600" dialup off secure -ttyU2 "/usr/libexec/getty std.9600" dialup off secure -ttyU3 "/usr/libexec/getty std.9600" dialup off secure +ttyu0 "/usr/libexec/getty std.115200" dialup on secure +ttyu1 "/usr/libexec/getty std.115200" dialup off secure +ttyu2 "/usr/libexec/getty std.115200" dialup off secure +ttyu3 "/usr/libexec/getty std.115200" dialup off secure # Pseudo terminals ttyp0 none network ttyp1 none network From owner-svn-src-head@FreeBSD.ORG Sun Oct 12 07:16:05 2008 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F16F3106568A; Sun, 12 Oct 2008 07:16:05 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id B1D388FC17; Sun, 12 Oct 2008 07:16:05 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id m9C7Dk18009198; Sun, 12 Oct 2008 01:13:46 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Sun, 12 Oct 2008 01:14:45 -0600 (MDT) Message-Id: <20081012.011445.163262685.imp@bsdimp.com> To: mav@FreeBSD.org From: "M. Warner Losh" In-Reply-To: <200810111730.m9BHU2u1023174@svn.freebsd.org> References: <200810111730.m9BHU2u1023174@svn.freebsd.org> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r183765 - head/sys/dev/mmc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Oct 2008 07:16:06 -0000 In message: <200810111730.m9BHU2u1023174@svn.freebsd.org> Alexander Motin writes: : Author: mav : Date: Sat Oct 11 17:30:02 2008 : New Revision: 183765 : URL: http://svn.freebsd.org/changeset/base/183765 : : Log: : SELECT_CARD command with zero RCA deselects all cards and so has no reply. : : Modified: : head/sys/dev/mmc/mmc.c : : Modified: head/sys/dev/mmc/mmc.c : ============================================================================== : --- head/sys/dev/mmc/mmc.c Sat Oct 11 17:28:22 2008 (r183764) : +++ head/sys/dev/mmc/mmc.c Sat Oct 11 17:30:02 2008 (r183765) : @@ -526,7 +526,7 @@ static int : mmc_select_card(struct mmc_softc *sc, uint16_t rca) : { : return (mmc_wait_for_command(sc, MMC_SELECT_CARD, ((uint32_t)rca) << 16, : - MMC_RSP_R1B | MMC_CMD_AC, NULL, CMD_RETRIES)); : + (rca?MMC_RSP_R1B:MMC_RSP_NONE) | MMC_CMD_AC, NULL, CMD_RETRIES)); Tertiary operators have spaces around ? and : in style(9), and the rest of this file uses that style. Warner From owner-svn-src-head@FreeBSD.ORG Sun Oct 12 07:24:31 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 97AA8106568F; Sun, 12 Oct 2008 07:24:31 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 85EB48FC0A; Sun, 12 Oct 2008 07:24:31 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9C7OV99038017; Sun, 12 Oct 2008 07:24:31 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9C7OVD8038016; Sun, 12 Oct 2008 07:24:31 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200810120724.m9C7OVD8038016@svn.freebsd.org> From: Warner Losh Date: Sun, 12 Oct 2008 07:24:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183774 - head/sys/dev/mmc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Oct 2008 07:24:31 -0000 Author: imp Date: Sun Oct 12 07:24:31 2008 New Revision: 183774 URL: http://svn.freebsd.org/changeset/base/183774 Log: Print the cards natural size. Move nested tertiary operator expressions into their own function. Remove extra blank line. cache sd->disk in 'd' to make the code easier to read. Modified: head/sys/dev/mmc/mmcsd.c Modified: head/sys/dev/mmc/mmcsd.c ============================================================================== --- head/sys/dev/mmc/mmcsd.c Sun Oct 12 06:58:03 2008 (r183773) +++ head/sys/dev/mmc/mmcsd.c Sun Oct 12 07:24:31 2008 (r183774) @@ -93,6 +93,9 @@ static int mmcsd_close(struct disk *dp); static void mmcsd_strategy(struct bio *bp); static void mmcsd_task(void *arg); +static const char *mmcsd_card_name(device_t dev); +static int mmcsd_bus_bit_width(device_t dev); + #define MMCSD_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) #define MMCSD_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) #define MMCSD_LOCK_INIT(_sc) \ @@ -115,34 +118,46 @@ static int mmcsd_attach(device_t dev) { struct mmcsd_softc *sc; + struct disk *d; + intmax_t mb; + char unit; sc = device_get_softc(dev); sc->dev = dev; MMCSD_LOCK_INIT(sc); - sc->disk = disk_alloc(); - sc->disk->d_open = mmcsd_open; - sc->disk->d_close = mmcsd_close; - sc->disk->d_strategy = mmcsd_strategy; - // sc->disk->d_dump = mmcsd_dump; Need polling mmc layer - sc->disk->d_name = "mmcsd"; - sc->disk->d_drv1 = sc; - sc->disk->d_maxsize = MAXPHYS; /* Maybe ask bridge? */ - sc->disk->d_sectorsize = mmc_get_sector_size(dev); - sc->disk->d_mediasize = mmc_get_media_size(dev) * - mmc_get_sector_size(dev); - sc->disk->d_unit = device_get_unit(dev); - - device_printf(dev, "%juMB <%s Memory Card>%s at %s %dMHz/%dbit\n", - sc->disk->d_mediasize / 1048576, - (mmc_get_card_type(dev) == mode_mmc)?"MMC": - (mmc_get_high_cap(dev)?"SDHC":"SD"), - mmc_get_read_only(dev)?" (read-only)":"", - device_get_nameunit(device_get_parent(sc->dev)), - mmc_get_tran_speed(dev)/1000000, - (mmc_get_bus_width(dev) == bus_width_1)?1: - ((mmc_get_bus_width(dev) == bus_width_4)?4:8)); - disk_create(sc->disk, DISK_VERSION); + d = sc->disk = disk_alloc(); + d->d_open = mmcsd_open; + d->d_close = mmcsd_close; + d->d_strategy = mmcsd_strategy; + // d->d_dump = mmcsd_dump; Need polling mmc layer + d->d_name = "mmcsd"; + d->d_drv1 = sc; + d->d_maxsize = MAXPHYS; /* Maybe ask bridge? */ + d->d_sectorsize = mmc_get_sector_size(dev); + d->d_mediasize = mmc_get_media_size(dev) * d->d_sectorsize; + d->d_unit = device_get_unit(dev); + /* + * Display in most natural units. There's no cards < 1MB. + * The SD standard goes to 2GiB, but the data format supports + * up to 4GiB and some card makers push it up to this limit. + * The SDHC standard only goes to 32GiB (the data format in + * SDHC is good to 2TiB however, which isn't too ugly at + * 2048GiBm, so we note it in passing here and don't add the + * code to print TiB). + */ + mb = d->d_mediasize >> 20; /* 1MiB == 1 << 20 */ + unit = 'M'; + if (mb > 1024) { /* 1GiB = 1024 MiB */ + unit = 'G'; + mb /= 1024; + } + device_printf(dev, "%ju%cB <%s Memory Card>%s at %s %dMHz/%dbit\n", + mb, unit, mmcsd_card_name(dev), + mmc_get_read_only(dev) ? " (read-only)" : "", + device_get_nameunit(device_get_parent(dev)), + mmc_get_tran_speed(dev) / 1000000, mmcsd_bus_bit_width(dev)); + disk_create(d, DISK_VERSION); bioq_init(&sc->bio_queue); sc->running = 1; @@ -306,6 +321,26 @@ mmcsd_task(void *arg) kproc_exit(0); } +static const char * +mmcsd_card_name(device_t dev) +{ + if (mmc_get_card_type(dev) == mode_mmc) + return ("MMC"); + if (mmc_get_high_cap(dev)) + return ("SDHC"); + return ("SD"); +} + +static int +mmcsd_bus_bit_width(device_t dev) +{ + if (mmc_get_bus_width(dev) == bus_width_1) + return (1); + if (mmc_get_bus_width(dev) == bus_width_4) + return (4); + return (8); +} + static device_method_t mmcsd_methods[] = { DEVMETHOD(device_probe, mmcsd_probe), DEVMETHOD(device_attach, mmcsd_attach), @@ -320,5 +355,4 @@ static driver_t mmcsd_driver = { }; static devclass_t mmcsd_devclass; - DRIVER_MODULE(mmcsd, mmc, mmcsd_driver, mmcsd_devclass, 0, 0); From owner-svn-src-head@FreeBSD.ORG Sun Oct 12 07:30:06 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4187D1065687; Sun, 12 Oct 2008 07:30:06 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2FF4B8FC1D; Sun, 12 Oct 2008 07:30:06 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9C7U67D038144; Sun, 12 Oct 2008 07:30:06 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9C7U61E038143; Sun, 12 Oct 2008 07:30:06 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200810120730.m9C7U61E038143@svn.freebsd.org> From: Warner Losh Date: Sun, 12 Oct 2008 07:30:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183775 - head/sys/dev/mmc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Oct 2008 07:30:06 -0000 Author: imp Date: Sun Oct 12 07:30:05 2008 New Revision: 183775 URL: http://svn.freebsd.org/changeset/base/183775 Log: style(9): spaces around operators. Modified: head/sys/dev/mmc/mmc.c Modified: head/sys/dev/mmc/mmc.c ============================================================================== --- head/sys/dev/mmc/mmc.c Sun Oct 12 07:24:31 2008 (r183774) +++ head/sys/dev/mmc/mmc.c Sun Oct 12 07:30:05 2008 (r183775) @@ -219,8 +219,8 @@ mmc_acquire_bus(device_t busdev, device_ if (bootverbose) { device_printf(busdev, "setting bus width to %d bits\n", - (ivar->bus_width == bus_width_4)?4: - (ivar->bus_width == bus_width_8)?8:1); + (ivar->bus_width == bus_width_4) ? 4 : + (ivar->bus_width == bus_width_8) ? 8 : 1); } mmc_set_card_bus_width(sc, rca, ivar->bus_width); mmcbr_set_bus_width(busdev, ivar->bus_width); @@ -525,8 +525,11 @@ mmc_power_down(struct mmc_softc *sc) static int mmc_select_card(struct mmc_softc *sc, uint16_t rca) { - return (mmc_wait_for_command(sc, MMC_SELECT_CARD, ((uint32_t)rca) << 16, - (rca?MMC_RSP_R1B:MMC_RSP_NONE) | MMC_CMD_AC, NULL, CMD_RETRIES)); + int flags; + + flags = (rca ? MMC_RSP_R1B : MMC_RSP_NONE) | MMC_CMD_AC; + return (mmc_wait_for_command(sc, MMC_SELECT_CARD, (uint32_t)rca << 16, + flags, NULL, CMD_RETRIES)); } static int @@ -1133,7 +1136,7 @@ mmc_go_discovery(struct mmc_softc *sc) mmcbr_set_bus_mode(dev, pushpull); mmc_idle_cards(sc); err = mmc_send_if_cond(sc, 1); - if (mmc_send_app_op_cond(sc, err?0:MMC_OCR_CCS, &ocr) != + if (mmc_send_app_op_cond(sc, err ? 0 : MMC_OCR_CCS, &ocr) != MMC_ERR_NONE) { /* * Failed, try MMC @@ -1163,7 +1166,7 @@ mmc_go_discovery(struct mmc_softc *sc) if (mmcbr_get_mode(dev) == mode_sd) { err = mmc_send_if_cond(sc, 1); mmc_send_app_op_cond(sc, - (err?0:MMC_OCR_CCS)|mmcbr_get_ocr(dev), NULL); + (err ? 0 : MMC_OCR_CCS) | mmcbr_get_ocr(dev), NULL); } else mmc_send_op_cond(sc, mmcbr_get_ocr(dev), NULL); mmc_discover_cards(sc); @@ -1213,9 +1216,10 @@ mmc_calculate_clock(struct mmc_softc *sc if (max_timing == bus_timing_hs) max_dtr = max_hs_dtr; if (bootverbose) { - device_printf(sc->dev, "setting transfer rate to %d.%03dMHz%s\n", + device_printf(sc->dev, + "setting transfer rate to %d.%03dMHz%s\n", max_dtr / 1000000, (max_dtr / 1000) % 1000, - (max_timing == bus_timing_hs)?" with high speed timing":""); + max_timing == bus_timing_hs ? " (high speed timing)" : ""); } mmcbr_set_timing(sc->dev, max_timing); mmcbr_set_clock(sc->dev, max_dtr); From owner-svn-src-head@FreeBSD.ORG Sun Oct 12 08:22:54 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0496D106569D; Sun, 12 Oct 2008 08:22:54 +0000 (UTC) (envelope-from simon@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E72AB8FC18; Sun, 12 Oct 2008 08:22:53 +0000 (UTC) (envelope-from simon@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9C8Mr9h039065; Sun, 12 Oct 2008 08:22:53 GMT (envelope-from simon@svn.freebsd.org) Received: (from simon@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9C8MrcX039064; Sun, 12 Oct 2008 08:22:53 GMT (envelope-from simon@svn.freebsd.org) Message-Id: <200810120822.m9C8MrcX039064@svn.freebsd.org> From: "Simon L. Nielsen" Date: Sun, 12 Oct 2008 08:22:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183776 - head/release/doc/share/misc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Oct 2008 08:22:54 -0000 Author: simon Date: Sun Oct 12 08:22:53 2008 New Revision: 183776 URL: http://svn.freebsd.org/changeset/base/183776 Log: ncr(4) is not supported on sparc64. See also: r183762 Modified: head/release/doc/share/misc/dev.archlist.txt Modified: head/release/doc/share/misc/dev.archlist.txt ============================================================================== --- head/release/doc/share/misc/dev.archlist.txt Sun Oct 12 07:30:05 2008 (r183775) +++ head/release/doc/share/misc/dev.archlist.txt Sun Oct 12 08:22:53 2008 (r183776) @@ -88,7 +88,7 @@ mly i386,ia64,amd64 msk i386,amd64 mxge i386,amd64 my i386,pc98 -ncr i386,pc98,sparc64,amd64 +ncr i386,pc98,amd64 ncv i386,pc98 nfe i386,amd64 ng_bt3c i386,pc98,amd64 From owner-svn-src-head@FreeBSD.ORG Sun Oct 12 19:19:26 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E23101065686; Sun, 12 Oct 2008 19:19:26 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D1AC78FC14; Sun, 12 Oct 2008 19:19:26 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9CJJQP7053334; Sun, 12 Oct 2008 19:19:26 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9CJJQ2t053333; Sun, 12 Oct 2008 19:19:26 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200810121919.m9CJJQ2t053333@svn.freebsd.org> From: Alexander Motin Date: Sun, 12 Oct 2008 19:19:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183805 - head/sys/dev/mmc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Oct 2008 19:19:27 -0000 Author: mav Date: Sun Oct 12 19:19:26 2008 New Revision: 183805 URL: http://svn.freebsd.org/changeset/base/183805 Log: Use GB suffix only from 10GB instead of 1GB. There are lot of cards with uneven sizes and too strong rounding will lead to very significant rounding errors. Reviewed by: imp@ Modified: head/sys/dev/mmc/mmcsd.c Modified: head/sys/dev/mmc/mmcsd.c ============================================================================== --- head/sys/dev/mmc/mmcsd.c Sun Oct 12 18:49:07 2008 (r183804) +++ head/sys/dev/mmc/mmcsd.c Sun Oct 12 19:19:26 2008 (r183805) @@ -148,7 +148,7 @@ mmcsd_attach(device_t dev) */ mb = d->d_mediasize >> 20; /* 1MiB == 1 << 20 */ unit = 'M'; - if (mb > 1024) { /* 1GiB = 1024 MiB */ + if (mb >= 10240) { /* 1GiB = 1024 MiB */ unit = 'G'; mb /= 1024; } From owner-svn-src-head@FreeBSD.ORG Sun Oct 12 19:23:02 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8D6321065690; Sun, 12 Oct 2008 19:23:02 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7CFE98FC19; Sun, 12 Oct 2008 19:23:02 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9CJN27j053445; Sun, 12 Oct 2008 19:23:02 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9CJN2F0053444; Sun, 12 Oct 2008 19:23:02 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200810121923.m9CJN2F0053444@svn.freebsd.org> From: Robert Watson Date: Sun, 12 Oct 2008 19:23:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183806 - head/sys/fs/portalfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Oct 2008 19:23:02 -0000 Author: rwatson Date: Sun Oct 12 19:23:02 2008 New Revision: 183806 URL: http://svn.freebsd.org/changeset/base/183806 Log: The locking in portalfs's socket connect code is no less correct than identical code in connect(2), so remove XXX that it might be incorrect. MFC after: 3 days Modified: head/sys/fs/portalfs/portal_vnops.c Modified: head/sys/fs/portalfs/portal_vnops.c ============================================================================== --- head/sys/fs/portalfs/portal_vnops.c Sun Oct 12 19:19:26 2008 (r183805) +++ head/sys/fs/portalfs/portal_vnops.c Sun Oct 12 19:23:02 2008 (r183806) @@ -279,7 +279,6 @@ portal_open(ap) * will happen if the server dies. Sleep for 5 second intervals * and keep polling the reference count. XXX. */ - /* XXXRW: Locking? */ SOCK_LOCK(so); while ((so->so_state & SS_ISCONNECTING) && so->so_error == 0) { if (fmp->pm_server->f_count == 1) { From owner-svn-src-head@FreeBSD.ORG Sun Oct 12 20:01:32 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F1DFB106569D; Sun, 12 Oct 2008 20:01:32 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E1A2B8FC0A; Sun, 12 Oct 2008 20:01:32 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9CK1WH6054138; Sun, 12 Oct 2008 20:01:32 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9CK1WAj054137; Sun, 12 Oct 2008 20:01:32 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200810122001.m9CK1WAj054137@svn.freebsd.org> From: Robert Watson Date: Sun, 12 Oct 2008 20:01:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183807 - head/sys/netinet6 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Oct 2008 20:01:33 -0000 Author: rwatson Date: Sun Oct 12 20:01:32 2008 New Revision: 183807 URL: http://svn.freebsd.org/changeset/base/183807 Log: When disconnecting a UDPv6 socket, acquire the socket lock around the changing of the so_state field, as is done in UDPv4. Remove XXX locking comment. MFC after: 3 days Modified: head/sys/netinet6/udp6_usrreq.c Modified: head/sys/netinet6/udp6_usrreq.c ============================================================================== --- head/sys/netinet6/udp6_usrreq.c Sun Oct 12 19:23:02 2008 (r183806) +++ head/sys/netinet6/udp6_usrreq.c Sun Oct 12 20:01:32 2008 (r183807) @@ -935,8 +935,9 @@ udp6_disconnect(struct socket *so) in6_pcbdisconnect(inp); inp->in6p_laddr = in6addr_any; - /* XXXRW: so_state locking? */ + SOCK_LOCK(so); so->so_state &= ~SS_ISCONNECTED; /* XXX */ + SOCK_UNLOCK(so); out: INP_WUNLOCK(inp); INP_INFO_WUNLOCK(&V_udbinfo); From owner-svn-src-head@FreeBSD.ORG Sun Oct 12 20:03:18 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F2A7A106568E; Sun, 12 Oct 2008 20:03:17 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E2A0F8FC0A; Sun, 12 Oct 2008 20:03:17 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9CK3HdN054210; Sun, 12 Oct 2008 20:03:17 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9CK3HXN054209; Sun, 12 Oct 2008 20:03:17 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200810122003.m9CK3HXN054209@svn.freebsd.org> From: Robert Watson Date: Sun, 12 Oct 2008 20:03:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183808 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Oct 2008 20:03:18 -0000 Author: rwatson Date: Sun Oct 12 20:03:17 2008 New Revision: 183808 URL: http://svn.freebsd.org/changeset/base/183808 Log: Downgrade XXX to a Note for fgetsock() and fputsock(). MFC after: 3 days Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Sun Oct 12 20:01:32 2008 (r183807) +++ head/sys/kern/kern_descrip.c Sun Oct 12 20:03:17 2008 (r183808) @@ -2150,7 +2150,7 @@ fgetvp_write(struct thread *td, int fd, * We bump the ref count on the returned socket. XXX Also obtain the SX lock * in the future. * - * XXXRW: fgetsock() and fputsock() are deprecated, as consumers should rely + * Note: fgetsock() and fputsock() are deprecated, as consumers should rely * on their file descriptor reference to prevent the socket from being free'd * during use. */ @@ -2183,7 +2183,7 @@ fgetsock(struct thread *td, int fd, stru * Drop the reference count on the socket and XXX release the SX lock in the * future. The last reference closes the socket. * - * XXXRW: fputsock() is deprecated, see comment for fgetsock(). + * Note: fputsock() is deprecated, see comment for fgetsock(). */ void fputsock(struct socket *so) From owner-svn-src-head@FreeBSD.ORG Sun Oct 12 20:06:59 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BEA4E1065688; Sun, 12 Oct 2008 20:06:59 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AE68D8FC08; Sun, 12 Oct 2008 20:06:59 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9CK6x5P054299; Sun, 12 Oct 2008 20:06:59 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9CK6x3n054298; Sun, 12 Oct 2008 20:06:59 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200810122006.m9CK6x3n054298@svn.freebsd.org> From: Robert Watson Date: Sun, 12 Oct 2008 20:06:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183809 - head/sys/nfsserver X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Oct 2008 20:06:59 -0000 Author: rwatson Date: Sun Oct 12 20:06:59 2008 New Revision: 183809 URL: http://svn.freebsd.org/changeset/base/183809 Log: Turn XXX's for unlocked writes of NFS server statistics to simple notes, as we consider it a feature to exchange performance for consistency. MFC after: 3 days Modified: head/sys/nfsserver/nfs_serv.c Modified: head/sys/nfsserver/nfs_serv.c ============================================================================== --- head/sys/nfsserver/nfs_serv.c Sun Oct 12 20:03:17 2008 (r183808) +++ head/sys/nfsserver/nfs_serv.c Sun Oct 12 20:06:59 2008 (r183809) @@ -1174,7 +1174,7 @@ nfsrv_write(struct nfsrv_descript *nfsd, uiop->uio_td = NULL; uiop->uio_offset = off; error = VOP_WRITE(vp, uiop, ioflags, cred); - /* XXXRW: unlocked write. */ + /* Unlocked write. */ nfsrvstats.srvvop_writes++; FREE((caddr_t)iv, M_TEMP); } @@ -1488,7 +1488,7 @@ loop1: } if (!error) { error = VOP_WRITE(vp, uiop, ioflags, cred); - /* XXXRW: unlocked write. */ + /* Unlocked write. */ nfsrvstats.srvvop_writes++; vn_finished_write(mntp); } From owner-svn-src-head@FreeBSD.ORG Sun Oct 12 21:42:22 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 01C81106568C; Sun, 12 Oct 2008 21:42:22 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E4C4E8FC0C; Sun, 12 Oct 2008 21:42:21 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9CLgLG3056259; Sun, 12 Oct 2008 21:42:21 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9CLgLaj056258; Sun, 12 Oct 2008 21:42:21 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200810122142.m9CLgLaj056258@svn.freebsd.org> From: Alexander Motin Date: Sun, 12 Oct 2008 21:42:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183810 - head/sys/dev/sound/pci/hda X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Oct 2008 21:42:22 -0000 Author: mav Date: Sun Oct 12 21:42:21 2008 New Revision: 183810 URL: http://svn.freebsd.org/changeset/base/183810 Log: Fix bug in a second call of the channel allocation function. This should fix crash on systems where two audio codecs connected to the same HDA bus. Modified: head/sys/dev/sound/pci/hda/hdac.c Modified: head/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdac.c Sun Oct 12 20:06:59 2008 (r183809) +++ head/sys/dev/sound/pci/hda/hdac.c Sun Oct 12 21:42:21 2008 (r183810) @@ -4945,7 +4945,7 @@ hdac_audio_bind_as(struct hdac_devinfo * } } else { sc->chans = (struct hdac_chan *)realloc(sc->chans, - sizeof(struct hdac_chan) * cnt, + sizeof(struct hdac_chan) * (sc->num_chans + cnt), M_HDAC, M_ZERO | M_NOWAIT); if (sc->chans == NULL) { sc->num_chans = 0; @@ -4963,7 +4963,6 @@ hdac_audio_bind_as(struct hdac_devinfo * } /* Assign associations in order of their numbers, */ - free = 0; for (j = 0; j < devinfo->function.audio.ascnt; j++) { if (as[j].enable == 0) continue; From owner-svn-src-head@FreeBSD.ORG Sun Oct 12 21:46:11 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7C8721065686; Sun, 12 Oct 2008 21:46:11 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6BF838FC15; Sun, 12 Oct 2008 21:46:11 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9CLkBQS056368; Sun, 12 Oct 2008 21:46:11 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9CLkBjW056367; Sun, 12 Oct 2008 21:46:11 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200810122146.m9CLkBjW056367@svn.freebsd.org> From: Alexander Motin Date: Sun, 12 Oct 2008 21:46:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183811 - head/sys/dev/sound/pci/hda X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Oct 2008 21:46:11 -0000 Author: mav Date: Sun Oct 12 21:46:11 2008 New Revision: 183811 URL: http://svn.freebsd.org/changeset/base/183811 Log: Bump driver revision after the previous commit. Modified: head/sys/dev/sound/pci/hda/hdac.c Modified: head/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdac.c Sun Oct 12 21:42:21 2008 (r183810) +++ head/sys/dev/sound/pci/hda/hdac.c Sun Oct 12 21:46:11 2008 (r183811) @@ -83,7 +83,7 @@ #include "mixer_if.h" -#define HDA_DRV_TEST_REV "20080916_0112" +#define HDA_DRV_TEST_REV "20081013_0113" SND_DECLARE_FILE("$FreeBSD$"); From owner-svn-src-head@FreeBSD.ORG Mon Oct 13 01:11:29 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3C6D2106569A; Mon, 13 Oct 2008 01:11:29 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 298F38FC08; Mon, 13 Oct 2008 01:11:29 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9D1BS8j059952; Mon, 13 Oct 2008 01:11:28 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9D1BScB059950; Mon, 13 Oct 2008 01:11:28 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200810130111.m9D1BScB059950@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 13 Oct 2008 01:11:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183814 - head/sys/dev/jme X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Oct 2008 01:11:29 -0000 Author: yongari Date: Mon Oct 13 01:11:28 2008 New Revision: 183814 URL: http://svn.freebsd.org/changeset/base/183814 Log: Read PCI device id instead of PCI revision id. Also checks the read device id is JMC260 family. Previously it just verified the deivce is JMC260 Rev A0. This will make it easy for newer JMC2xx support. Pointed out by: bouyer at NetBSD Modified: head/sys/dev/jme/if_jme.c head/sys/dev/jme/if_jmereg.h Modified: head/sys/dev/jme/if_jme.c ============================================================================== --- head/sys/dev/jme/if_jme.c Sun Oct 12 23:47:06 2008 (r183813) +++ head/sys/dev/jme/if_jme.c Mon Oct 13 01:11:28 2008 (r183814) @@ -624,8 +624,8 @@ jme_attach(device_t dev) goto fail; } - sc->jme_rev = pci_get_revid(dev); - if (sc->jme_rev == DEVICEID_JMC260) { + sc->jme_rev = pci_get_device(dev); + if ((sc->jme_rev & DEVICEID_JMC2XX_MASK) == DEVICEID_JMC260) { sc->jme_flags |= JME_FLAG_FASTETH; sc->jme_flags |= JME_FLAG_NOJUMBO; } Modified: head/sys/dev/jme/if_jmereg.h ============================================================================== --- head/sys/dev/jme/if_jmereg.h Sun Oct 12 23:47:06 2008 (r183813) +++ head/sys/dev/jme/if_jmereg.h Mon Oct 13 01:11:28 2008 (r183814) @@ -48,6 +48,8 @@ #define DEVICEID_JMC260 0x0260 #define DEVICEREVID_JMC260_A0 0x00 +#define DEVICEID_JMC2XX_MASK 0x0FF0 + /* JMC250 PCI configuration register. */ #define JME_PCI_BAR0 0x10 /* 16KB memory window. */ From owner-svn-src-head@FreeBSD.ORG Mon Oct 13 06:07:58 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D7998106568B; Mon, 13 Oct 2008 06:07:58 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C70E28FC2D; Mon, 13 Oct 2008 06:07:58 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9D67wLw065198; Mon, 13 Oct 2008 06:07:58 GMT (envelope-from bms@svn.freebsd.org) Received: (from bms@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9D67wNU065197; Mon, 13 Oct 2008 06:07:58 GMT (envelope-from bms@svn.freebsd.org) Message-Id: <200810130607.m9D67wNU065197@svn.freebsd.org> From: Bruce M Simpson Date: Mon, 13 Oct 2008 06:07:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183815 - head/sys/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Oct 2008 06:07:59 -0000 Author: bms Date: Mon Oct 13 06:07:58 2008 New Revision: 183815 URL: http://svn.freebsd.org/changeset/base/183815 Log: Fix the CFE ldscript after the cutover to tradmips. Diff minimization against ldscript.mips. Note: CFE will not load PT_DYNAMIC segments, therefore the dynamic sections have been placed in a PT_LOAD segment for now. This is not too efficient in terms of memory use, they should probably get placed in the text segment. Modified: head/sys/conf/ldscript.mips.cfe Modified: head/sys/conf/ldscript.mips.cfe ============================================================================== --- head/sys/conf/ldscript.mips.cfe Mon Oct 13 01:11:28 2008 (r183814) +++ head/sys/conf/ldscript.mips.cfe Mon Oct 13 06:07:58 2008 (r183815) @@ -1,9 +1,46 @@ +/*- + * Copyright (c) 2001, 2004, 2008, Juniper Networks, Inc. + * 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. + * 3. Neither the name of the Juniper Networks, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY JUNIPER NETWORKS 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 JUNIPER NETWORKS 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. + * + * JNPR: ldscript.mips,v 1.3 2006/10/11 06:12:04 + * $FreeBSD$ + */ + /* - * This linker script is needed to build a kernel for use by Broadcom CFE. + * This linker script is needed to build a kernel for use by Broadcom CFE + * when loaded over TFTP; its ELF loader does not support backwards seek + * on network I/O streams. + * Furthermore, CFE will only load PT_LOAD segments, therefore the dynamic + * sections must be placed in their own segment. */ -/* $FreeBSD$ */ -OUTPUT_FORMAT("elf32-tradbigmips", "elf32-tradbigmips", "elf32-tradlittlemips") +OUTPUT_FORMAT("elf32-tradbigmips", "elf32-tradbigmips", + "elf32-tradlittlemips") + OUTPUT_ARCH(mips) ENTRY(_start) SEARCH_DIR(/usr/lib); @@ -11,23 +48,22 @@ SEARCH_DIR(/usr/lib); __DYNAMIC = 0; PROVIDE (_DYNAMIC = 0); */ -DYNAMIC_LINK = 0; /* XXX */ + +PHDRS +{ + headers PT_PHDR FILEHDR PHDRS ; + interp PT_INTERP ; + text PT_LOAD ; + dynamic PT_LOAD ; + data PT_LOAD ; +} + SECTIONS { /* Read-only sections, merged into text segment: */ - . = 0x80001000; - .text : - { - *(.trap) - *(.text) - *(.text.*) - *(.stub) - /* .gnu.warning sections are handled specially by elf32.em. */ - *(.gnu.warning) - *(.gnu.linkonce.t.*) - } - .interp : { *(.interp) } - .hash : { *(.hash) } + . = 0x80100000 ; + .interp : { *(.interp) } :interp + .hash : { *(.hash) } :text .dynsym : { *(.dynsym) } .dynstr : { *(.dynstr) } .gnu.version : { *(.gnu.version) } @@ -141,12 +177,20 @@ SECTIONS } .rel.plt : { *(.rel.plt) } .rela.plt : { *(.rela.plt) } - .init : { KEEP (*(.init)) - } - + } :text =0x1000000 + .text : + { + *(.trap) + *(.text) + *(.text.*) + *(.stub) + /* .gnu.warning sections are handled specially by elf32.em. */ + *(.gnu.warning) + *(.gnu.linkonce.t.*) + } =0x1000000 .fini : { KEEP (*(.fini)) @@ -166,7 +210,7 @@ SECTIONS *(.data.*) *(.gnu.linkonce.d.*) SORT(CONSTRUCTORS) - } + } :data .data1 : { *(.data1) } .eh_frame : { KEEP (*(.eh_frame)) } .gcc_except_table : { *(.gcc_except_table) } @@ -200,7 +244,7 @@ SECTIONS .plt : { *(.plt) } _gp = ALIGN(16) + 0x7ff0; .got : { *(.got.plt) *(.got) } - .dynamic : { *(.dynamic) } + .dynamic : { *(.dynamic) } :dynamic /* We want the small data sections together, so single-instruction offsets can access them all, and initialized data all before uninitialized, so we can shorten the on-disk segment size. */ From owner-svn-src-head@FreeBSD.ORG Mon Oct 13 06:25:29 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 433EC1065688; Mon, 13 Oct 2008 06:25:29 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 332908FC19; Mon, 13 Oct 2008 06:25:29 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9D6PTwO065538; Mon, 13 Oct 2008 06:25:29 GMT (envelope-from bms@svn.freebsd.org) Received: (from bms@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9D6PTOW065537; Mon, 13 Oct 2008 06:25:29 GMT (envelope-from bms@svn.freebsd.org) Message-Id: <200810130625.m9D6PTOW065537@svn.freebsd.org> From: Bruce M Simpson Date: Mon, 13 Oct 2008 06:25:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183816 - head/sys/mips/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Oct 2008 06:25:29 -0000 Author: bms Date: Mon Oct 13 06:25:28 2008 New Revision: 183816 URL: http://svn.freebsd.org/changeset/base/183816 Log: Point this config at the required linker script. Modified: head/sys/mips/conf/SENTRY5 Modified: head/sys/mips/conf/SENTRY5 ============================================================================== --- head/sys/mips/conf/SENTRY5 Mon Oct 13 06:07:58 2008 (r183815) +++ head/sys/mips/conf/SENTRY5 Mon Oct 13 06:25:28 2008 (r183816) @@ -47,6 +47,8 @@ options ALT_BREAK_TO_DEBUGGER # XXX can we conditionalize the linker stuff on options CFE? options KERNVIRTADDR=0x80001000 +makeoptions LDSCRIPT_NAME= ldscript.mips.cfe + #makeoptions ARCH_FLAGS=-march=mips32 makeoptions MIPS_LITTLE_ENDIAN=defined makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols From owner-svn-src-head@FreeBSD.ORG Mon Oct 13 12:28:33 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D2E4B1065693; Mon, 13 Oct 2008 12:28:33 +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 C0C108FC0A; Mon, 13 Oct 2008 12:28:33 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9DCSXbR076151; Mon, 13 Oct 2008 12:28:33 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9DCSXql076150; Mon, 13 Oct 2008 12:28:33 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200810131228.m9DCSXql076150@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Mon, 13 Oct 2008 12:28:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183817 - head/sys/dev/puc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Oct 2008 12:28:33 -0000 Author: des Date: Mon Oct 13 12:28:33 2008 New Revision: 183817 URL: http://svn.freebsd.org/changeset/base/183817 Log: Revert r179409; it breaks all OX16PCI954-based cards except the SIIG 4. MFC after: 3 days Modified: head/sys/dev/puc/pucdata.c Modified: head/sys/dev/puc/pucdata.c ============================================================================== --- head/sys/dev/puc/pucdata.c Mon Oct 13 06:25:28 2008 (r183816) +++ head/sys/dev/puc/pucdata.c Mon Oct 13 12:28:33 2008 (r183817) @@ -603,14 +603,14 @@ const struct puc_cfg puc_pci_devices[] = }, { 0x1415, 0x9501, 0xffff, 0, - "Oxford Semiconductor OX16PCI954 UARTs 4-port type 1", - DEFAULT_RCLK * 10, + "Oxford Semiconductor OX16PCI954 UARTs", + DEFAULT_RCLK, PUC_PORT_4S, 0x10, 0, 8, }, { 0x1415, 0x950a, 0xffff, 0, - "Oxford Semiconductor OX16PCI954 UARTs 4-port type 2", - DEFAULT_RCLK * 10, + "Oxford Semiconductor OX16PCI954 UARTs", + DEFAULT_RCLK, PUC_PORT_4S, 0x10, 0, 8, }, From owner-svn-src-head@FreeBSD.ORG Mon Oct 13 13:56:23 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 76A93106568B; Mon, 13 Oct 2008 13:56:23 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 64F618FC1A; Mon, 13 Oct 2008 13:56:23 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9DDuNwb077737; Mon, 13 Oct 2008 13:56:23 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9DDuNhA077736; Mon, 13 Oct 2008 13:56:23 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200810131356.m9DDuNhA077736@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 13 Oct 2008 13:56:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183820 - head/sbin/fsck_ffs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Oct 2008 13:56:23 -0000 Author: kib Date: Mon Oct 13 13:56:23 2008 New Revision: 183820 URL: http://svn.freebsd.org/changeset/base/183820 Log: check_maps() in /usr/src/sbin/fsck_ffs/pass5.c seems to be limited to file systems less than 1 TB, due to using 32-bits integers for file system block numbers. This also causes incorrect error reporting for foreground fsck. Convert it to use ufs2_daddr_t for block numbers. PR: kern/127951 Submitted by: tegge MFC after: 1 week Modified: head/sbin/fsck_ffs/pass5.c Modified: head/sbin/fsck_ffs/pass5.c ============================================================================== --- head/sbin/fsck_ffs/pass5.c Mon Oct 13 13:00:21 2008 (r183819) +++ head/sbin/fsck_ffs/pass5.c Mon Oct 13 13:56:23 2008 (r183820) @@ -48,7 +48,7 @@ __FBSDID("$FreeBSD$"); #include "fsck.h" -static void check_maps(u_char *, u_char *, int, int, const char *, int *, int, int); +static void check_maps(u_char *, u_char *, int, ufs2_daddr_t, const char *, int *, int, int); void pass5(void) @@ -321,13 +321,17 @@ pass5(void) } if (excessdirs > 0) check_maps(cg_inosused(newcg), cg_inosused(cg), - inomapsize, cg->cg_cgx * fs->fs_ipg, "DIR", + inomapsize, + cg->cg_cgx * (ufs2_daddr_t) fs->fs_ipg, + "DIR", freedirs, 0, excessdirs); check_maps(cg_inosused(newcg), cg_inosused(cg), - inomapsize, cg->cg_cgx * fs->fs_ipg, "FILE", + inomapsize, + cg->cg_cgx * (ufs2_daddr_t) fs->fs_ipg, "FILE", freefiles, excessdirs, fs->fs_ipg); check_maps(cg_blksfree(cg), cg_blksfree(newcg), - blkmapsize, cg->cg_cgx * fs->fs_fpg, "FRAG", + blkmapsize, + cg->cg_cgx * (ufs2_daddr_t) fs->fs_fpg, "FRAG", freeblks, 0, fs->fs_fpg); } if (cursnapshot == 0 && @@ -407,7 +411,7 @@ check_maps( u_char *map1, /* map of claimed allocations */ u_char *map2, /* map of determined allocations */ int mapsize, /* size of above two maps */ - int startvalue, /* resource value for first element in map */ + ufs2_daddr_t startvalue, /* resource value for first element in map */ const char *name, /* name of resource found in maps */ int *opcode, /* sysctl opcode to free resource */ int skip, /* number of entries to skip before starting to free */ @@ -415,8 +419,8 @@ check_maps( { # define BUFSIZE 16 char buf[BUFSIZE]; - long i, j, k, l, m, n, size; - int astart, aend, ustart, uend; + long i, j, k, l, m, size; + ufs2_daddr_t n, astart, aend, ustart, uend; void (*msg)(const char *fmt, ...); if (bkgrdflag) @@ -443,10 +447,12 @@ check_maps( continue; } if (astart == aend) - (*msg)("ALLOCATED %s %d MARKED FREE\n", + (*msg)("ALLOCATED %s %" PRId64 + " MARKED FREE\n", name, astart); else - (*msg)("%s %sS %d-%d MARKED FREE\n", + (*msg)("%s %sS %" PRId64 "-%" PRId64 + " MARKED FREE\n", "ALLOCATED", name, astart, aend); astart = aend = n; } else { @@ -472,10 +478,12 @@ check_maps( if (size > limit) size = limit; if (debug && size == 1) - pwarn("%s %s %d MARKED USED\n", + pwarn("%s %s %" PRId64 + " MARKED USED\n", "UNALLOCATED", name, ustart); else if (debug) - pwarn("%s %sS %d-%ld MARKED USED\n", + pwarn("%s %sS %" PRId64 "-%" PRId64 + " MARKED USED\n", "UNALLOCATED", name, ustart, ustart + size - 1); if (bkgrdflag != 0) { @@ -497,9 +505,11 @@ check_maps( } if (astart != -1) { if (astart == aend) - (*msg)("ALLOCATED %s %d MARKED FREE\n", name, astart); + (*msg)("ALLOCATED %s %" PRId64 + " MARKED FREE\n", name, astart); else - (*msg)("ALLOCATED %sS %d-%d MARKED FREE\n", + (*msg)("ALLOCATED %sS %" PRId64 "-%" PRId64 + " MARKED FREE\n", name, astart, aend); } if (ustart != -1) { @@ -514,10 +524,12 @@ check_maps( size = limit; if (debug) { if (size == 1) - pwarn("UNALLOCATED %s %d MARKED USED\n", + pwarn("UNALLOCATED %s %" PRId64 + " MARKED USED\n", name, ustart); else - pwarn("UNALLOCATED %sS %d-%ld MARKED USED\n", + pwarn("UNALLOCATED %sS %" PRId64 "-%" PRId64 + " MARKED USED\n", name, ustart, ustart + size - 1); } if (bkgrdflag != 0) { From owner-svn-src-head@FreeBSD.ORG Mon Oct 13 14:01:06 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 37B491065686; Mon, 13 Oct 2008 14:01:06 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 262D28FC38; Mon, 13 Oct 2008 14:01:06 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9DE16Hb077878; Mon, 13 Oct 2008 14:01:06 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9DE16LW077877; Mon, 13 Oct 2008 14:01:06 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200810131401.m9DE16LW077877@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 13 Oct 2008 14:01:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183821 - head/sbin/fsck_ffs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Oct 2008 14:01:06 -0000 Author: kib Date: Mon Oct 13 14:01:05 2008 New Revision: 183821 URL: http://svn.freebsd.org/changeset/base/183821 Log: Background fsck applies twice some summary totals changes. The next background fsck on the same file system might then print negative numbers for reclaimed directories/files/fragments. Address the issue in a limited degree, by using old summary data for cg when bgfsck is performed. Submitted by: tegge MFC after: 1 week Modified: head/sbin/fsck_ffs/pass5.c Modified: head/sbin/fsck_ffs/pass5.c ============================================================================== --- head/sbin/fsck_ffs/pass5.c Mon Oct 13 13:56:23 2008 (r183820) +++ head/sbin/fsck_ffs/pass5.c Mon Oct 13 14:01:05 2008 (r183821) @@ -291,10 +291,17 @@ pass5(void) sump[run]++; } } - cstotal.cs_nffree += newcg->cg_cs.cs_nffree; - cstotal.cs_nbfree += newcg->cg_cs.cs_nbfree; - cstotal.cs_nifree += newcg->cg_cs.cs_nifree; - cstotal.cs_ndir += newcg->cg_cs.cs_ndir; + if (bkgrdflag != 0) { + cstotal.cs_nffree += cg->cg_cs.cs_nffree; + cstotal.cs_nbfree += cg->cg_cs.cs_nbfree; + cstotal.cs_nifree += cg->cg_cs.cs_nifree; + cstotal.cs_ndir += cg->cg_cs.cs_ndir; + } else { + cstotal.cs_nffree += newcg->cg_cs.cs_nffree; + cstotal.cs_nbfree += newcg->cg_cs.cs_nbfree; + cstotal.cs_nifree += newcg->cg_cs.cs_nifree; + cstotal.cs_ndir += newcg->cg_cs.cs_ndir; + } cs = &fs->fs_cs(fs, c); if (cursnapshot == 0 && memcmp(&newcg->cg_cs, cs, sizeof *cs) != 0 && From owner-svn-src-head@FreeBSD.ORG Mon Oct 13 14:05:01 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EC4EC1065678; Mon, 13 Oct 2008 14:05:01 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DABD28FC16; Mon, 13 Oct 2008 14:05:01 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9DE51vO077978; Mon, 13 Oct 2008 14:05:01 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9DE51Zq077977; Mon, 13 Oct 2008 14:05:01 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200810131405.m9DE51Zq077977@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 13 Oct 2008 14:05:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183822 - head/sys/ufs/ffs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Oct 2008 14:05:02 -0000 Author: kib Date: Mon Oct 13 14:05:01 2008 New Revision: 183822 URL: http://svn.freebsd.org/changeset/base/183822 Log: Sync up summary information for cylinder groups while data is already in memory during snapshot creation. This improves the results of the background fsck. Submitted by: tegge MFC after: 1 week Modified: head/sys/ufs/ffs/ffs_snapshot.c Modified: head/sys/ufs/ffs/ffs_snapshot.c ============================================================================== --- head/sys/ufs/ffs/ffs_snapshot.c Mon Oct 13 14:01:05 2008 (r183821) +++ head/sys/ufs/ffs/ffs_snapshot.c Mon Oct 13 14:05:01 2008 (r183822) @@ -864,6 +864,13 @@ cgaccount(cg, vp, nbp, passno) } UFS_LOCK(ip->i_ump); ACTIVESET(fs, cg); + /* + * Recomputation of summary information might not have been performed + * at mount time. Sync up summary information for current cylinder + * group while data is in memory to ensure that result of background + * fsck is slightly more consistent. + */ + fs->fs_cs(fs, cg) = cgp->cg_cs; UFS_UNLOCK(ip->i_ump); bcopy(bp->b_data, nbp->b_data, fs->fs_cgsize); if (fs->fs_cgsize < fs->fs_bsize) From owner-svn-src-head@FreeBSD.ORG Mon Oct 13 17:14:29 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D70C41065686; Mon, 13 Oct 2008 17:14:29 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C56228FC08; Mon, 13 Oct 2008 17:14:29 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9DHETYo081376; Mon, 13 Oct 2008 17:14:29 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9DHET4q081375; Mon, 13 Oct 2008 17:14:29 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <200810131714.m9DHET4q081375@svn.freebsd.org> From: Nathan Whitehorn Date: Mon, 13 Oct 2008 17:14:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183825 - head/sys/boot/ofw/libofw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Oct 2008 17:14:30 -0000 Author: nwhitehorn Date: Mon Oct 13 17:14:29 2008 New Revision: 183825 URL: http://svn.freebsd.org/changeset/base/183825 Log: Don't close OF disk devices on PowerPC. This fixes loader when booting from disk on my Blue & White G3 system. Modified: head/sys/boot/ofw/libofw/ofw_disk.c Modified: head/sys/boot/ofw/libofw/ofw_disk.c ============================================================================== --- head/sys/boot/ofw/libofw/ofw_disk.c Mon Oct 13 16:46:24 2008 (r183824) +++ head/sys/boot/ofw/libofw/ofw_disk.c Mon Oct 13 17:14:29 2008 (r183825) @@ -155,7 +155,9 @@ ofwd_close(struct open_file *f) if (odp->count == 0) { SLIST_REMOVE(&opened_devs, odp, opened_dev, link); + #if !defined(__powerpc__) OF_close(odp->handle); + #endif free(odp); } break; From owner-svn-src-head@FreeBSD.ORG Mon Oct 13 17:33:56 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0C4AA10656CD; Mon, 13 Oct 2008 17:33:56 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EF0758FC15; Mon, 13 Oct 2008 17:33:55 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9DHXttH081805; Mon, 13 Oct 2008 17:33:55 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9DHXtUc081804; Mon, 13 Oct 2008 17:33:55 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <200810131733.m9DHXtUc081804@svn.freebsd.org> From: Nathan Whitehorn Date: Mon, 13 Oct 2008 17:33:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183827 - head/sys/dev/bm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Oct 2008 17:33:56 -0000 Author: nwhitehorn Date: Mon Oct 13 17:33:55 2008 New Revision: 183827 URL: http://svn.freebsd.org/changeset/base/183827 Log: Change the way we enable the BMAC cell in macio. Instead of calling the macio's enable-enet word, which apparently does nothing on some machines, open an OF instance of the ethernet controller. This fixes cold booting from disk on my Blue & White G3. MFC after: 3 days Modified: head/sys/dev/bm/if_bm.c Modified: head/sys/dev/bm/if_bm.c ============================================================================== --- head/sys/dev/bm/if_bm.c Mon Oct 13 17:33:44 2008 (r183826) +++ head/sys/dev/bm/if_bm.c Mon Oct 13 17:33:55 2008 (r183827) @@ -1119,21 +1119,25 @@ bm_chip_setup(struct bm_softc *sc) { uint16_t reg; uint16_t *eaddr_sect; - char hrow_path[128]; - ihandle_t hrow_ih; + char path[128]; + ihandle_t bmac_ih; eaddr_sect = (uint16_t *)(sc->sc_enaddr); - /* Enable BMAC cell */ - OF_package_to_path(OF_parent(ofw_bus_get_node(sc->sc_dev)), - hrow_path, sizeof(hrow_path)); - hrow_ih = OF_open(hrow_path); - if (hrow_ih == -1) { + /* + * Enable BMAC cell by opening and closing its OF node. This enables + * the cell in macio as a side effect. We should probably directly + * twiddle the FCR bits, but we lack a good interface for this at the + * present time. + */ + + OF_package_to_path(ofw_bus_get_node(sc->sc_dev), path, sizeof(path)); + bmac_ih = OF_open(path); + if (bmac_ih == -1) { device_printf(sc->sc_dev, "Enabling BMAC cell failed! Hoping it's already active.\n"); } else { - OF_call_method("enable-enet", hrow_ih, 0, 0); - OF_close(hrow_ih); + OF_close(bmac_ih); } /* Reset chip */ From owner-svn-src-head@FreeBSD.ORG Mon Oct 13 17:38:05 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 065671065687; Mon, 13 Oct 2008 17:38:05 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E8F658FC18; Mon, 13 Oct 2008 17:38:04 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9DHc4aE081916; Mon, 13 Oct 2008 17:38:04 GMT (envelope-from rnoland@svn.freebsd.org) Received: (from rnoland@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9DHc47A081913; Mon, 13 Oct 2008 17:38:04 GMT (envelope-from rnoland@svn.freebsd.org) Message-Id: <200810131738.m9DHc47A081913@svn.freebsd.org> From: Robert Noland Date: Mon, 13 Oct 2008 17:38:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183828 - head/sys/dev/drm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Oct 2008 17:38:05 -0000 Author: rnoland Date: Mon Oct 13 17:38:04 2008 New Revision: 183828 URL: http://svn.freebsd.org/changeset/base/183828 Log: Add support for Radeon rs740 (HD 2100) Approved by: jhb (mentor) Obtained from: drm git master Modified: head/sys/dev/drm/drm_pciids.h head/sys/dev/drm/radeon_cp.c head/sys/dev/drm/radeon_drv.h Modified: head/sys/dev/drm/drm_pciids.h ============================================================================== --- head/sys/dev/drm/drm_pciids.h Mon Oct 13 17:33:55 2008 (r183827) +++ head/sys/dev/drm/drm_pciids.h Mon Oct 13 17:38:04 2008 (r183828) @@ -242,6 +242,10 @@ {0x1002, 0x7835, CHIP_RS300|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Radeon RS350 Mobility IGP"}, \ {0x1002, 0x791e, CHIP_RS690|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART, "ATI Radeon RS690 X1250 IGP"}, \ {0x1002, 0x791f, CHIP_RS690|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART, "ATI Radeon RS690 X1270 IGP"}, \ + {0x1002, 0x796c, CHIP_RS740|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART, "ATI Radeon RS740 HD2100 IGP"}, \ + {0x1002, 0x796d, CHIP_RS740|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART, "ATI Radeon RS740 HD2100 IGP"}, \ + {0x1002, 0x796e, CHIP_RS740|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART, "ATI Radeon RS740 HD2100 IGP"}, \ + {0x1002, 0x796f, CHIP_RS740|RADEON_IS_IGP|RADEON_NEW_MEMMAP|RADEON_IS_IGPGART, "ATI Radeon RS740 HD2100 IGP"}, \ {0, 0, 0, NULL} #define r128_PCI_IDS \ Modified: head/sys/dev/drm/radeon_cp.c ============================================================================== --- head/sys/dev/drm/radeon_cp.c Mon Oct 13 17:33:55 2008 (r183827) +++ head/sys/dev/drm/radeon_cp.c Mon Oct 13 17:38:04 2008 (r183828) @@ -73,7 +73,8 @@ static u32 RS690_READ_MCIND(drm_radeon_p static u32 IGP_READ_MCIND(drm_radeon_private_t *dev_priv, int addr) { - if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) + if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) || + ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS740)) return RS690_READ_MCIND(dev_priv, addr); else return RS480_READ_MCIND(dev_priv, addr); @@ -84,7 +85,8 @@ u32 radeon_read_fb_location(drm_radeon_p if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515) return R500_READ_MCIND(dev_priv, RV515_MC_FB_LOCATION); - else if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) + else if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) || + ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS740)) return RS690_READ_MCIND(dev_priv, RS690_MC_FB_LOCATION); else if ((dev_priv->flags & RADEON_FAMILY_MASK) > CHIP_RV515) return R500_READ_MCIND(dev_priv, R520_MC_FB_LOCATION); @@ -96,7 +98,8 @@ static void radeon_write_fb_location(drm { if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515) R500_WRITE_MCIND(RV515_MC_FB_LOCATION, fb_loc); - else if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) + else if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) || + ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS740)) RS690_WRITE_MCIND(RS690_MC_FB_LOCATION, fb_loc); else if ((dev_priv->flags & RADEON_FAMILY_MASK) > CHIP_RV515) R500_WRITE_MCIND(R520_MC_FB_LOCATION, fb_loc); @@ -108,7 +111,8 @@ static void radeon_write_agp_location(dr { if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515) R500_WRITE_MCIND(RV515_MC_AGP_LOCATION, agp_loc); - else if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) + else if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) || + ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS740)) RS690_WRITE_MCIND(RS690_MC_AGP_LOCATION, agp_loc); else if ((dev_priv->flags & RADEON_FAMILY_MASK) > CHIP_RV515) R500_WRITE_MCIND(R520_MC_AGP_LOCATION, agp_loc); @@ -124,7 +128,8 @@ static void radeon_write_agp_base(drm_ra if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515) { R500_WRITE_MCIND(RV515_MC_AGP_BASE, agp_base_lo); R500_WRITE_MCIND(RV515_MC_AGP_BASE_2, agp_base_hi); - } else if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) { + } else if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) || + ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS740)) { RS690_WRITE_MCIND(RS690_MC_AGP_BASE, agp_base_lo); RS690_WRITE_MCIND(RS690_MC_AGP_BASE_2, agp_base_hi); } else if ((dev_priv->flags & RADEON_FAMILY_MASK) > CHIP_RV515) { @@ -369,8 +374,9 @@ static void radeon_cp_load_microcode(drm RADEON_WRITE(RADEON_CP_ME_RAM_DATAL, R420_cp_microcode[i][0]); } - } else if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) { - DRM_INFO("Loading RS690 Microcode\n"); + } else if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) || + ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS740)) { + DRM_INFO("Loading RS690/RS740 Microcode\n"); for (i = 0; i < 256; i++) { RADEON_WRITE(RADEON_CP_ME_RAM_DATAH, RS690_cp_microcode[i][1]); @@ -721,7 +727,8 @@ static void radeon_set_igpgart(drm_radeo temp = IGP_READ_MCIND(dev_priv, RS480_MC_MISC_CNTL); - if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) + if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) || + ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS740)) IGP_WRITE_MCIND(RS480_MC_MISC_CNTL, (RS480_GART_INDEX_REG_EN | RS690_BLOCK_GFX_D3_EN)); else @@ -814,6 +821,7 @@ static void radeon_set_pcigart(drm_radeo u32 tmp; if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) || + ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS740) || (dev_priv->flags & RADEON_IS_IGPGART)) { radeon_set_igpgart(dev_priv, on); return; Modified: head/sys/dev/drm/radeon_drv.h ============================================================================== --- head/sys/dev/drm/radeon_drv.h Mon Oct 13 17:33:55 2008 (r183827) +++ head/sys/dev/drm/radeon_drv.h Mon Oct 13 17:38:04 2008 (r183828) @@ -130,6 +130,7 @@ enum radeon_family { CHIP_RS400, CHIP_RS480, CHIP_RS690, + CHIP_RS740, CHIP_RV515, CHIP_R520, CHIP_RV530, @@ -1235,7 +1236,8 @@ do { \ #define IGP_WRITE_MCIND( addr, val ) \ do { \ - if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) \ + if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) || \ + ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS740)) \ RS690_WRITE_MCIND( addr, val ); \ else \ RS480_WRITE_MCIND( addr, val ); \ From owner-svn-src-head@FreeBSD.ORG Mon Oct 13 17:42:22 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2EAAA1065692; Mon, 13 Oct 2008 17:42:22 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1D8658FC1D; Mon, 13 Oct 2008 17:42:22 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9DHgMon082021; Mon, 13 Oct 2008 17:42:22 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9DHgMeB082020; Mon, 13 Oct 2008 17:42:22 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <200810131742.m9DHgMeB082020@svn.freebsd.org> From: Ken Smith Date: Mon, 13 Oct 2008 17:42:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183829 - head/release/scripts X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Oct 2008 17:42:22 -0000 Author: kensmith Date: Mon Oct 13 17:42:21 2008 New Revision: 183829 URL: http://svn.freebsd.org/changeset/base/183829 Log: Fix minor typo. Modified: head/release/scripts/package-trees.sh Modified: head/release/scripts/package-trees.sh ============================================================================== --- head/release/scripts/package-trees.sh Mon Oct 13 17:38:04 2008 (r183828) +++ head/release/scripts/package-trees.sh Mon Oct 13 17:42:21 2008 (r183829) @@ -5,7 +5,7 @@ # contains the master INDEX, it's assigned list of packages, and the # appropriate tree of category symlinks. # -# Usage: package-tress.sh +# Usage: package-trees.sh # # $FreeBSD$ From owner-svn-src-head@FreeBSD.ORG Mon Oct 13 17:43:40 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 655DA1065687; Mon, 13 Oct 2008 17:43:40 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 533CF8FC13; Mon, 13 Oct 2008 17:43:40 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9DHheRJ082083; Mon, 13 Oct 2008 17:43:40 GMT (envelope-from rnoland@svn.freebsd.org) Received: (from rnoland@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9DHheBc082080; Mon, 13 Oct 2008 17:43:40 GMT (envelope-from rnoland@svn.freebsd.org) Message-Id: <200810131743.m9DHheBc082080@svn.freebsd.org> From: Robert Noland Date: Mon, 13 Oct 2008 17:43:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183830 - head/sys/dev/drm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Oct 2008 17:43:40 -0000 Author: rnoland Date: Mon Oct 13 17:43:39 2008 New Revision: 183830 URL: http://svn.freebsd.org/changeset/base/183830 Log: Several of the newer radeon cards have moved around the registers for enabling busmastering support. This also adds register definitions for MSI support, which we will be using shortly. Approved by: jhb (mentor) Obtained from: drm git master Modified: head/sys/dev/drm/drm_pciids.h head/sys/dev/drm/radeon_cp.c head/sys/dev/drm/radeon_drv.h Modified: head/sys/dev/drm/drm_pciids.h ============================================================================== --- head/sys/dev/drm/drm_pciids.h Mon Oct 13 17:42:21 2008 (r183829) +++ head/sys/dev/drm/drm_pciids.h Mon Oct 13 17:43:39 2008 (r183830) @@ -86,18 +86,18 @@ {0x1002, 0x5460, CHIP_RV380|RADEON_IS_MOBILITY, "ATI Radeon Mobility X300 M22"}, \ {0x1002, 0x5462, CHIP_RV380|RADEON_IS_MOBILITY, "ATI Radeon Mobility X600 SE M24C"}, \ {0x1002, 0x5464, CHIP_RV380|RADEON_IS_MOBILITY, "ATI FireGL M22 GL 5464"}, \ - {0x1002, 0x5548, CHIP_R420|RADEON_NEW_MEMMAP, "ATI Radeon R423 X800"}, \ - {0x1002, 0x5549, CHIP_R420|RADEON_NEW_MEMMAP, "ATI Radeon R423 X800 Pro"}, \ - {0x1002, 0x554A, CHIP_R420|RADEON_NEW_MEMMAP, "ATI Radeon R423 X800 XT PE"}, \ - {0x1002, 0x554B, CHIP_R420|RADEON_NEW_MEMMAP, "ATI Radeon R423 X800 SE"}, \ - {0x1002, 0x554C, CHIP_R420|RADEON_NEW_MEMMAP, "ATI Radeon R430 X800 XTP"}, \ - {0x1002, 0x554D, CHIP_R420|RADEON_NEW_MEMMAP, "ATI Radeon R430 X800 XL"}, \ - {0x1002, 0x554E, CHIP_R420|RADEON_NEW_MEMMAP, "ATI Radeon R430 X800 SE"}, \ - {0x1002, 0x554F, CHIP_R420|RADEON_NEW_MEMMAP, "ATI Radeon R430 X800"}, \ - {0x1002, 0x5550, CHIP_R420|RADEON_NEW_MEMMAP, "ATI FireGL V7100 R423"}, \ - {0x1002, 0x5551, CHIP_R420|RADEON_NEW_MEMMAP, "ATI FireGL V5100 R423 UQ"}, \ - {0x1002, 0x5552, CHIP_R420|RADEON_NEW_MEMMAP, "ATI FireGL unknown R423 UR"}, \ - {0x1002, 0x5554, CHIP_R420|RADEON_NEW_MEMMAP, "ATI FireGL unknown R423 UT"}, \ + {0x1002, 0x5548, CHIP_R423|RADEON_NEW_MEMMAP, "ATI Radeon R423 X800"}, \ + {0x1002, 0x5549, CHIP_R423|RADEON_NEW_MEMMAP, "ATI Radeon R423 X800 Pro"}, \ + {0x1002, 0x554A, CHIP_R423|RADEON_NEW_MEMMAP, "ATI Radeon R423 X800 XT PE"}, \ + {0x1002, 0x554B, CHIP_R423|RADEON_NEW_MEMMAP, "ATI Radeon R423 X800 SE"}, \ + {0x1002, 0x554C, CHIP_R423|RADEON_NEW_MEMMAP, "ATI Radeon R430 X800 XTP"}, \ + {0x1002, 0x554D, CHIP_R423|RADEON_NEW_MEMMAP, "ATI Radeon R430 X800 XL"}, \ + {0x1002, 0x554E, CHIP_R423|RADEON_NEW_MEMMAP, "ATI Radeon R430 X800 SE"}, \ + {0x1002, 0x554F, CHIP_R423|RADEON_NEW_MEMMAP, "ATI Radeon R430 X800"}, \ + {0x1002, 0x5550, CHIP_R423|RADEON_NEW_MEMMAP, "ATI FireGL V7100 R423"}, \ + {0x1002, 0x5551, CHIP_R423|RADEON_NEW_MEMMAP, "ATI FireGL V5100 R423 UQ"}, \ + {0x1002, 0x5552, CHIP_R423|RADEON_NEW_MEMMAP, "ATI FireGL unknown R423 UR"}, \ + {0x1002, 0x5554, CHIP_R423|RADEON_NEW_MEMMAP, "ATI FireGL unknown R423 UT"}, \ {0x1002, 0x564A, CHIP_RV410|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility FireGL V5000 M26"}, \ {0x1002, 0x564B, CHIP_RV410|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility FireGL V5000 M26"}, \ {0x1002, 0x564F, CHIP_RV410|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Radeon Mobility X700 XL M26"}, \ @@ -127,16 +127,16 @@ {0x1002, 0x5b65, CHIP_RV380|RADEON_NEW_MEMMAP, "ATI FireMV 2200 PCIE (RV370) 5B65"}, \ {0x1002, 0x5c61, CHIP_RV280|RADEON_IS_MOBILITY, "ATI Radeon RV280 Mobility"}, \ {0x1002, 0x5c63, CHIP_RV280|RADEON_IS_MOBILITY, "ATI Radeon RV280 Mobility"}, \ - {0x1002, 0x5d48, CHIP_R420|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon X800 XT M28"}, \ - {0x1002, 0x5d49, CHIP_R420|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility FireGL V5100 M28"}, \ - {0x1002, 0x5d4a, CHIP_R420|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon X800 M28"}, \ - {0x1002, 0x5d4c, CHIP_R420|RADEON_NEW_MEMMAP, "ATI Radeon R480 X850"}, \ - {0x1002, 0x5d4d, CHIP_R420|RADEON_NEW_MEMMAP, "ATI Radeon R480 X850 XT PE"}, \ - {0x1002, 0x5d4e, CHIP_R420|RADEON_NEW_MEMMAP, "ATI Radeon R480 X850 SE"}, \ - {0x1002, 0x5d4f, CHIP_R420|RADEON_NEW_MEMMAP, "ATI Radeon R480 X850 Pro"}, \ - {0x1002, 0x5d50, CHIP_R420|RADEON_NEW_MEMMAP, "ATI unknown Radeon / FireGL R480"}, \ - {0x1002, 0x5d52, CHIP_R420|RADEON_NEW_MEMMAP, "ATI Radeon R480 X850 XT"}, \ - {0x1002, 0x5d57, CHIP_R420|RADEON_NEW_MEMMAP, "ATI Radeon R423 X800 XT"}, \ + {0x1002, 0x5d48, CHIP_R423|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon X800 XT M28"}, \ + {0x1002, 0x5d49, CHIP_R423|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility FireGL V5100 M28"}, \ + {0x1002, 0x5d4a, CHIP_R423|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP, "ATI Mobility Radeon X800 M28"}, \ + {0x1002, 0x5d4c, CHIP_R423|RADEON_NEW_MEMMAP, "ATI Radeon R480 X850"}, \ + {0x1002, 0x5d4d, CHIP_R423|RADEON_NEW_MEMMAP, "ATI Radeon R480 X850 XT PE"}, \ + {0x1002, 0x5d4e, CHIP_R423|RADEON_NEW_MEMMAP, "ATI Radeon R480 X850 SE"}, \ + {0x1002, 0x5d4f, CHIP_R423|RADEON_NEW_MEMMAP, "ATI Radeon R480 X850 Pro"}, \ + {0x1002, 0x5d50, CHIP_R423|RADEON_NEW_MEMMAP, "ATI unknown Radeon / FireGL R480"}, \ + {0x1002, 0x5d52, CHIP_R423|RADEON_NEW_MEMMAP, "ATI Radeon R480 X850 XT"}, \ + {0x1002, 0x5d57, CHIP_R423|RADEON_NEW_MEMMAP, "ATI Radeon R423 X800 XT"}, \ {0x1002, 0x5e48, CHIP_RV410|RADEON_NEW_MEMMAP, "ATI FireGL V5000 RV410"}, \ {0x1002, 0x5e4a, CHIP_RV410|RADEON_NEW_MEMMAP, "ATI Radeon RV410 X700 XT"}, \ {0x1002, 0x5e4b, CHIP_RV410|RADEON_NEW_MEMMAP, "ATI Radeon RV410 X700 Pro"}, \ Modified: head/sys/dev/drm/radeon_cp.c ============================================================================== --- head/sys/dev/drm/radeon_cp.c Mon Oct 13 17:42:21 2008 (r183829) +++ head/sys/dev/drm/radeon_cp.c Mon Oct 13 17:43:39 2008 (r183830) @@ -366,6 +366,7 @@ static void radeon_cp_load_microcode(drm R300_cp_microcode[i][0]); } } else if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_R420) || + ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_R423) || ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV410)) { DRM_INFO("Loading R400 Microcode\n"); for (i = 0; i < 256; i++) { @@ -654,8 +655,18 @@ static void radeon_cp_init_ring_buffer(s RADEON_WRITE(RADEON_SCRATCH_UMSK, 0x7); /* Turn on bus mastering */ - tmp = RADEON_READ(RADEON_BUS_CNTL) & ~RADEON_BUS_MASTER_DIS; - RADEON_WRITE(RADEON_BUS_CNTL, tmp); + if (((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS400) || + ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS690) || + ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RS740)) { + /* rs400, rs690/rs740 */ + tmp = RADEON_READ(RADEON_BUS_CNTL) & ~RS400_BUS_MASTER_DIS; + RADEON_WRITE(RADEON_BUS_CNTL, tmp); + } else if (!(((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV380) || + ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R423))) { + /* r1xx, r2xx, r300, r(v)350, r420/r481, rs480 */ + tmp = RADEON_READ(RADEON_BUS_CNTL) & ~RADEON_BUS_MASTER_DIS; + RADEON_WRITE(RADEON_BUS_CNTL, tmp); + } /* PCIE cards appears to not need this */ dev_priv->sarea_priv->last_frame = dev_priv->scratch[0] = 0; RADEON_WRITE(RADEON_LAST_FRAME_REG, dev_priv->sarea_priv->last_frame); @@ -1718,6 +1729,7 @@ int radeon_driver_load(struct drm_device case CHIP_R300: case CHIP_R350: case CHIP_R420: + case CHIP_R423: case CHIP_RV410: case CHIP_RV515: case CHIP_R520: Modified: head/sys/dev/drm/radeon_drv.h ============================================================================== --- head/sys/dev/drm/radeon_drv.h Mon Oct 13 17:42:21 2008 (r183829) +++ head/sys/dev/drm/radeon_drv.h Mon Oct 13 17:43:39 2008 (r183830) @@ -126,6 +126,7 @@ enum radeon_family { CHIP_RV350, CHIP_RV380, CHIP_R420, + CHIP_R423, CHIP_RV410, CHIP_RS400, CHIP_RS480, @@ -434,8 +435,31 @@ extern int r300_do_cp_cmdbuf(struct drm_ # define RADEON_SCISSOR_1_ENABLE (1 << 29) # define RADEON_SCISSOR_2_ENABLE (1 << 30) +/* + * PCIE radeons (rv370/rv380, rv410, r423/r430/r480, r5xx) + * don't have an explicit bus mastering disable bit. It's handled + * by the PCI D-states. PMI_BM_DIS disables D-state bus master + * handling, not bus mastering itself. + */ #define RADEON_BUS_CNTL 0x0030 +/* r1xx, r2xx, r300, r(v)350, r420/r481, rs480 */ # define RADEON_BUS_MASTER_DIS (1 << 6) +/* rs400, rs690/rs740 */ +# define RS400_BUS_MASTER_DIS (1 << 14) +# define RS400_MSI_REARM (1 << 20) +/* see RS480_MSI_REARM in AIC_CNTL for rs480 */ + +#define RADEON_BUS_CNTL1 0x0034 +# define RADEON_PMI_BM_DIS (1 << 2) +# define RADEON_PMI_INT_DIS (1 << 3) + +#define RV370_BUS_CNTL 0x004c +# define RV370_PMI_BM_DIS (1 << 5) +# define RV370_PMI_INT_DIS (1 << 6) + +#define RADEON_MSI_REARM_EN 0x0160 +/* rv370/rv380, rv410, r423/r430/r480, r5xx */ +# define RV370_MSI_REARM_EN (1 << 0) #define RADEON_CLOCK_CNTL_DATA 0x000c # define RADEON_PLL_WR_EN (1 << 7) @@ -915,6 +939,7 @@ extern int r300_do_cp_cmdbuf(struct drm_ #define RADEON_AIC_CNTL 0x01d0 # define RADEON_PCIGART_TRANSLATE_EN (1 << 0) +# define RS480_MSI_REARM (1 << 3) #define RADEON_AIC_STAT 0x01d4 #define RADEON_AIC_PT_BASE 0x01d8 #define RADEON_AIC_LO_ADDR 0x01dc From owner-svn-src-head@FreeBSD.ORG Mon Oct 13 17:47:13 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7E617106564A; Mon, 13 Oct 2008 17:47:13 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6D7238FC2C; Mon, 13 Oct 2008 17:47:13 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9DHlDK8082193; Mon, 13 Oct 2008 17:47:13 GMT (envelope-from rnoland@svn.freebsd.org) Received: (from rnoland@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9DHlD5W082192; Mon, 13 Oct 2008 17:47:13 GMT (envelope-from rnoland@svn.freebsd.org) Message-Id: <200810131747.m9DHlD5W082192@svn.freebsd.org> From: Robert Noland Date: Mon, 13 Oct 2008 17:47:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183831 - head/sys/dev/drm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Oct 2008 17:47:13 -0000 Author: rnoland Date: Mon Oct 13 17:47:13 2008 New Revision: 183831 URL: http://svn.freebsd.org/changeset/base/183831 Log: Correct the interrupt handling in the Intel i915 driver. Approved by: jhb (mentor) Modified: head/sys/dev/drm/i915_irq.c Modified: head/sys/dev/drm/i915_irq.c ============================================================================== --- head/sys/dev/drm/i915_irq.c Mon Oct 13 17:43:39 2008 (r183830) +++ head/sys/dev/drm/i915_irq.c Mon Oct 13 17:47:13 2008 (r183831) @@ -460,26 +460,31 @@ irqreturn_t i915_driver_irq_handler(DRM_ */ if (iir & I915_DISPLAY_PIPE_A_EVENT_INTERRUPT) { pipea_stats = I915_READ(PIPEASTAT); - if (pipea_stats & (PIPE_START_VBLANK_INTERRUPT_STATUS| - PIPE_VBLANK_INTERRUPT_STATUS)) + + /* The vblank interrupt gets enabled even if we didn't ask for + it, so make sure it's shut down again */ + if (!(dev_priv->vblank_pipe & DRM_I915_VBLANK_PIPE_A)) + pipea_stats &= ~(PIPE_START_VBLANK_INTERRUPT_ENABLE | + PIPE_VBLANK_INTERRUPT_ENABLE); + else if (pipea_stats & (PIPE_START_VBLANK_INTERRUPT_STATUS| + PIPE_VBLANK_INTERRUPT_STATUS)) { vblank++; drm_handle_vblank(dev, i915_get_plane(dev, 0)); } + I915_WRITE(PIPEASTAT, pipea_stats); } if (iir & I915_DISPLAY_PIPE_B_EVENT_INTERRUPT) { pipeb_stats = I915_READ(PIPEBSTAT); - /* Ack the event */ - I915_WRITE(PIPEBSTAT, pipeb_stats); /* The vblank interrupt gets enabled even if we didn't ask for it, so make sure it's shut down again */ if (!(dev_priv->vblank_pipe & DRM_I915_VBLANK_PIPE_B)) - pipeb_stats &= ~(I915_VBLANK_INTERRUPT_ENABLE); - - if (pipeb_stats & (PIPE_START_VBLANK_INTERRUPT_STATUS| - PIPE_VBLANK_INTERRUPT_STATUS)) + pipeb_stats &= ~(PIPE_START_VBLANK_INTERRUPT_ENABLE | + PIPE_VBLANK_INTERRUPT_ENABLE); + else if (pipeb_stats & (PIPE_START_VBLANK_INTERRUPT_STATUS| + PIPE_VBLANK_INTERRUPT_STATUS)) { vblank++; drm_handle_vblank(dev, i915_get_plane(dev, 1)); @@ -950,9 +955,9 @@ void i915_driver_irq_preinstall(struct d { drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; - I915_WRITE16(HWSTAM, 0xeffe); - I915_WRITE16(IMR, 0x0); - I915_WRITE16(IER, 0x0); + I915_WRITE(HWSTAM, 0xeffe); + I915_WRITE(IMR, 0xffffffff); + I915_WRITE(IER, 0x0); } int i915_driver_irq_postinstall(struct drm_device * dev) From owner-svn-src-head@FreeBSD.ORG Mon Oct 13 17:52:42 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 30D9A106568E; Mon, 13 Oct 2008 17:52:42 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1E0D98FC27; Mon, 13 Oct 2008 17:52:42 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9DHqgOn082323; Mon, 13 Oct 2008 17:52:42 GMT (envelope-from rnoland@svn.freebsd.org) Received: (from rnoland@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9DHqgF7082322; Mon, 13 Oct 2008 17:52:42 GMT (envelope-from rnoland@svn.freebsd.org) Message-Id: <200810131752.m9DHqgF7082322@svn.freebsd.org> From: Robert Noland Date: Mon, 13 Oct 2008 17:52:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183832 - head/sys/dev/drm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Oct 2008 17:52:43 -0000 Author: rnoland Date: Mon Oct 13 17:52:41 2008 New Revision: 183832 URL: http://svn.freebsd.org/changeset/base/183832 Log: The linux list compat code had an error which prevented list_for_each_safe() from operating on a list with a single item. This code is used much more by the i915 driver with xorg-7.4. Correct it to match the actual linux implementation. Approved by: jhb (mentor) Modified: head/sys/dev/drm/drm_linux_list.h Modified: head/sys/dev/drm/drm_linux_list.h ============================================================================== --- head/sys/dev/drm/drm_linux_list.h Mon Oct 13 17:47:13 2008 (r183831) +++ head/sys/dev/drm/drm_linux_list.h Mon Oct 13 17:52:41 2008 (r183832) @@ -69,6 +69,6 @@ list_del(struct list_head *entry) { #define list_for_each_safe(entry, temp, head) \ for (entry = (head)->next, temp = (entry)->next; \ - temp != head; \ - entry = temp, temp = temp->next) + entry != head; \ + entry = temp, temp = entry->next) From owner-svn-src-head@FreeBSD.ORG Mon Oct 13 18:03:28 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 90AEF1065694; Mon, 13 Oct 2008 18:03:28 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7DB6F8FC1E; Mon, 13 Oct 2008 18:03:28 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9DI3SqQ082590; Mon, 13 Oct 2008 18:03:28 GMT (envelope-from rnoland@svn.freebsd.org) Received: (from rnoland@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9DI3R1o082570; Mon, 13 Oct 2008 18:03:27 GMT (envelope-from rnoland@svn.freebsd.org) Message-Id: <200810131803.m9DI3R1o082570@svn.freebsd.org> From: Robert Noland Date: Mon, 13 Oct 2008 18:03:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183833 - head/sys/dev/drm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Oct 2008 18:03:28 -0000 Author: rnoland Date: Mon Oct 13 18:03:27 2008 New Revision: 183833 URL: http://svn.freebsd.org/changeset/base/183833 Log: Rework memory allocation to allocate memory with different type names. This will ease the identification of memory leaks as the OS will be able to track allocations for us by malloc type. vmstat -m will show all of the allocations. Convert the calls to drm_alloc() and friends, which are used in shared code to static __inline__ while we are here. Approved by: jhb (mentor) Modified: head/sys/dev/drm/ati_pcigart.c head/sys/dev/drm/drmP.h head/sys/dev/drm/drm_agpsupport.c head/sys/dev/drm/drm_auth.c head/sys/dev/drm/drm_bufs.c head/sys/dev/drm/drm_context.c head/sys/dev/drm/drm_dma.c head/sys/dev/drm/drm_drv.c head/sys/dev/drm/drm_fops.c head/sys/dev/drm/drm_ioctl.c head/sys/dev/drm/drm_irq.c head/sys/dev/drm/drm_memory.c head/sys/dev/drm/drm_pci.c head/sys/dev/drm/drm_scatter.c head/sys/dev/drm/drm_sysctl.c head/sys/dev/drm/i915_drv.c head/sys/dev/drm/mach64_drv.c head/sys/dev/drm/mga_drv.c head/sys/dev/drm/r128_drv.c head/sys/dev/drm/radeon_drv.c head/sys/dev/drm/savage_drv.c head/sys/dev/drm/sis_drv.c head/sys/dev/drm/tdfx_drv.c Modified: head/sys/dev/drm/ati_pcigart.c ============================================================================== --- head/sys/dev/drm/ati_pcigart.c Mon Oct 13 17:52:41 2008 (r183832) +++ head/sys/dev/drm/ati_pcigart.c Mon Oct 13 18:03:27 2008 (r183833) @@ -64,7 +64,8 @@ drm_ati_alloc_pcigart_table(struct drm_d struct drm_dma_handle *dmah; int flags, ret; - dmah = malloc(sizeof(struct drm_dma_handle), M_DRM, M_ZERO | M_NOWAIT); + dmah = malloc(sizeof(struct drm_dma_handle), DRM_MEM_DMA, + M_ZERO | M_NOWAIT); if (dmah == NULL) return ENOMEM; @@ -77,7 +78,7 @@ drm_ati_alloc_pcigart_table(struct drm_d BUS_DMA_ALLOCNOW, NULL, NULL, /* flags, lockfunc, lockfuncargs */ &dmah->tag); if (ret != 0) { - free(dmah, M_DRM); + free(dmah, DRM_MEM_DMA); return ENOMEM; } @@ -88,7 +89,7 @@ drm_ati_alloc_pcigart_table(struct drm_d ret = bus_dmamem_alloc(dmah->tag, &dmah->vaddr, flags, &dmah->map); if (ret != 0) { bus_dma_tag_destroy(dmah->tag); - free(dmah, M_DRM); + free(dmah, DRM_MEM_DMA); return ENOMEM; } DRM_LOCK(); @@ -98,7 +99,7 @@ drm_ati_alloc_pcigart_table(struct drm_d if (ret != 0) { bus_dmamem_free(dmah->tag, dmah->vaddr, dmah->map); bus_dma_tag_destroy(dmah->tag); - free(dmah, M_DRM); + free(dmah, DRM_MEM_DMA); return ENOMEM; } @@ -115,7 +116,7 @@ drm_ati_free_pcigart_table(struct drm_de bus_dmamem_free(dmah->tag, dmah->vaddr, dmah->map); bus_dma_tag_destroy(dmah->tag); - free(dmah, M_DRM); + free(dmah, DRM_MEM_DMA); dev->sg->dmah = NULL; } Modified: head/sys/dev/drm/drmP.h ============================================================================== --- head/sys/dev/drm/drmP.h Mon Oct 13 17:52:41 2008 (r183832) +++ head/sys/dev/drm/drmP.h Mon Oct 13 18:03:27 2008 (r183833) @@ -129,27 +129,24 @@ struct drm_file; #define DRM_KERNEL_CONTEXT 0 /* Change drm_resctx if changed */ #define DRM_RESERVED_CONTEXTS 1 /* Change drm_resctx if changed */ -#define DRM_MEM_DMA 0 -#define DRM_MEM_SAREA 1 -#define DRM_MEM_DRIVER 2 -#define DRM_MEM_MAGIC 3 -#define DRM_MEM_IOCTLS 4 -#define DRM_MEM_MAPS 5 -#define DRM_MEM_BUFS 6 -#define DRM_MEM_SEGS 7 -#define DRM_MEM_PAGES 8 -#define DRM_MEM_FILES 9 -#define DRM_MEM_QUEUES 10 -#define DRM_MEM_CMDS 11 -#define DRM_MEM_MAPPINGS 12 -#define DRM_MEM_BUFLISTS 13 -#define DRM_MEM_AGPLISTS 14 -#define DRM_MEM_TOTALAGP 15 -#define DRM_MEM_BOUNDAGP 16 -#define DRM_MEM_CTXBITMAP 17 -#define DRM_MEM_STUB 18 -#define DRM_MEM_SGLISTS 19 -#define DRM_MEM_DRAWABLE 20 +MALLOC_DECLARE(DRM_MEM_DMA); +MALLOC_DECLARE(DRM_MEM_SAREA); +MALLOC_DECLARE(DRM_MEM_DRIVER); +MALLOC_DECLARE(DRM_MEM_MAGIC); +MALLOC_DECLARE(DRM_MEM_IOCTLS); +MALLOC_DECLARE(DRM_MEM_MAPS); +MALLOC_DECLARE(DRM_MEM_BUFS); +MALLOC_DECLARE(DRM_MEM_SEGS); +MALLOC_DECLARE(DRM_MEM_PAGES); +MALLOC_DECLARE(DRM_MEM_FILES); +MALLOC_DECLARE(DRM_MEM_QUEUES); +MALLOC_DECLARE(DRM_MEM_CMDS); +MALLOC_DECLARE(DRM_MEM_MAPPINGS); +MALLOC_DECLARE(DRM_MEM_BUFLISTS); +MALLOC_DECLARE(DRM_MEM_AGPLISTS); +MALLOC_DECLARE(DRM_MEM_CTXBITMAP); +MALLOC_DECLARE(DRM_MEM_SGLISTS); +MALLOC_DECLARE(DRM_MEM_DRAWABLE); #define DRM_MAX_CTXBITMAP (PAGE_SIZE * 8) @@ -160,8 +157,6 @@ struct drm_file; #define DRM_IF_VERSION(maj, min) (maj << 16 | min) -MALLOC_DECLARE(M_DRM); - #define __OS_HAS_AGP 1 #define DRM_DEV_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP) @@ -748,11 +743,6 @@ extern int drm_open_helper(struct cdev /* Memory management support (drm_memory.c) */ void drm_mem_init(void); void drm_mem_uninit(void); -void *drm_alloc(size_t size, int area); -void *drm_calloc(size_t nmemb, size_t size, int area); -void *drm_realloc(void *oldpt, size_t oldsize, size_t size, - int area); -void drm_free(void *pt, size_t size, int area); void *drm_ioremap_wc(struct drm_device *dev, drm_local_map_t *map); void *drm_ioremap(struct drm_device *dev, drm_local_map_t *map); void drm_ioremapfree(drm_local_map_t *map); @@ -966,6 +956,32 @@ drm_dma_handle_t *drm_pci_alloc(struct d size_t align, dma_addr_t maxaddr); void drm_pci_free(struct drm_device *dev, drm_dma_handle_t *dmah); +/* Inline replacements for drm_alloc and friends */ +static __inline__ void * +drm_alloc(size_t size, struct malloc_type *area) +{ + return malloc(size, area, M_NOWAIT); +} + +static __inline__ void * +drm_calloc(size_t nmemb, size_t size, struct malloc_type *area) +{ + return malloc(size * nmemb, area, M_NOWAIT | M_ZERO); +} + +static __inline__ void * +drm_realloc(void *oldpt, size_t oldsize, size_t size, + struct malloc_type *area) +{ + return reallocf(oldpt, size, area, M_NOWAIT); +} + +static __inline__ void +drm_free(void *pt, size_t size, struct malloc_type *area) +{ + free(pt, area); +} + /* Inline replacements for DRM_IOREMAP macros */ static __inline__ void drm_core_ioremap_wc(struct drm_local_map *map, struct drm_device *dev) Modified: head/sys/dev/drm/drm_agpsupport.c ============================================================================== --- head/sys/dev/drm/drm_agpsupport.c Mon Oct 13 17:52:41 2008 (r183832) +++ head/sys/dev/drm/drm_agpsupport.c Mon Oct 13 18:03:27 2008 (r183833) @@ -212,7 +212,7 @@ int drm_agp_alloc(struct drm_device *dev if (!dev->agp || !dev->agp->acquired) return EINVAL; - entry = malloc(sizeof(*entry), M_DRM, M_NOWAIT | M_ZERO); + entry = malloc(sizeof(*entry), DRM_MEM_AGPLISTS, M_NOWAIT | M_ZERO); if (entry == NULL) return ENOMEM; @@ -223,7 +223,7 @@ int drm_agp_alloc(struct drm_device *dev handle = drm_agp_allocate_memory(pages, type); DRM_LOCK(); if (handle == NULL) { - free(entry, M_DRM); + free(entry, DRM_MEM_AGPLISTS); return ENOMEM; } @@ -374,7 +374,7 @@ int drm_agp_free(struct drm_device *dev, drm_agp_free_memory(entry->handle); DRM_LOCK(); - free(entry, M_DRM); + free(entry, DRM_MEM_AGPLISTS); return 0; @@ -408,7 +408,8 @@ drm_agp_head_t *drm_agp_init(void) DRM_DEBUG("agp_available = %d\n", agp_available); if (agp_available) { - head = malloc(sizeof(*head), M_DRM, M_NOWAIT | M_ZERO); + head = malloc(sizeof(*head), DRM_MEM_AGPLISTS, + M_NOWAIT | M_ZERO); if (head == NULL) return NULL; head->agpdev = agpdev; Modified: head/sys/dev/drm/drm_auth.c ============================================================================== --- head/sys/dev/drm/drm_auth.c Mon Oct 13 17:52:41 2008 (r183832) +++ head/sys/dev/drm/drm_auth.c Mon Oct 13 18:03:27 2008 (r183833) @@ -77,7 +77,7 @@ static int drm_add_magic(struct drm_devi DRM_SPINLOCK_ASSERT(&dev->dev_lock); hash = drm_hash_magic(magic); - entry = malloc(sizeof(*entry), M_DRM, M_ZERO | M_NOWAIT); + entry = malloc(sizeof(*entry), DRM_MEM_MAGIC, M_ZERO | M_NOWAIT); if (!entry) return ENOMEM; entry->magic = magic; @@ -121,7 +121,7 @@ static int drm_remove_magic(struct drm_d if (prev) { prev->next = pt->next; } - free(pt, M_DRM); + free(pt, DRM_MEM_MAGIC); return 0; } } Modified: head/sys/dev/drm/drm_bufs.c ============================================================================== --- head/sys/dev/drm/drm_bufs.c Mon Oct 13 17:52:41 2008 (r183832) +++ head/sys/dev/drm/drm_bufs.c Mon Oct 13 18:03:27 2008 (r183833) @@ -138,7 +138,7 @@ int drm_addmap(struct drm_device * dev, /* Allocate a new map structure, fill it in, and do any type-specific * initialization necessary. */ - map = malloc(sizeof(*map), M_DRM, M_ZERO | M_NOWAIT); + map = malloc(sizeof(*map), DRM_MEM_MAPS, M_ZERO | M_NOWAIT); if (!map) { DRM_LOCK(); return ENOMEM; @@ -160,11 +160,11 @@ int drm_addmap(struct drm_device * dev, map->mtrr = 1; break; case _DRM_SHM: - map->handle = malloc(map->size, M_DRM, M_NOWAIT); + map->handle = malloc(map->size, DRM_MEM_MAPS, M_NOWAIT); DRM_DEBUG("%lu %d %p\n", map->size, drm_order(map->size), map->handle); if (!map->handle) { - free(map, M_DRM); + free(map, DRM_MEM_MAPS); DRM_LOCK(); return ENOMEM; } @@ -174,8 +174,8 @@ int drm_addmap(struct drm_device * dev, DRM_LOCK(); if (dev->lock.hw_lock != NULL) { DRM_UNLOCK(); - free(map->handle, M_DRM); - free(map, M_DRM); + free(map->handle, DRM_MEM_MAPS); + free(map, DRM_MEM_MAPS); return EBUSY; } dev->lock.hw_lock = map->handle; /* Pointer to lock */ @@ -205,14 +205,14 @@ int drm_addmap(struct drm_device * dev, } } if (!valid) { - free(map, M_DRM); + free(map, DRM_MEM_MAPS); DRM_LOCK(); return EACCES; }*/ break; case _DRM_SCATTER_GATHER: if (!dev->sg) { - free(map, M_DRM); + free(map, DRM_MEM_MAPS); DRM_LOCK(); return EINVAL; } @@ -230,7 +230,7 @@ int drm_addmap(struct drm_device * dev, align = PAGE_SIZE; map->dmah = drm_pci_alloc(dev, map->size, align, 0xfffffffful); if (map->dmah == NULL) { - free(map, M_DRM); + free(map, DRM_MEM_MAPS); DRM_LOCK(); return ENOMEM; } @@ -239,7 +239,7 @@ int drm_addmap(struct drm_device * dev, break; default: DRM_ERROR("Bad map type %d\n", map->type); - free(map, M_DRM); + free(map, DRM_MEM_MAPS); DRM_LOCK(); return EINVAL; } @@ -313,7 +313,7 @@ void drm_rmmap(struct drm_device *dev, d } break; case _DRM_SHM: - free(map->handle, M_DRM); + free(map->handle, DRM_MEM_MAPS); break; case _DRM_AGP: case _DRM_SCATTER_GATHER: @@ -331,7 +331,7 @@ void drm_rmmap(struct drm_device *dev, d map->bsr); } - free(map, M_DRM); + free(map, DRM_MEM_MAPS); } /* Remove a map private from list and deallocate resources if the mapping @@ -374,16 +374,16 @@ static void drm_cleanup_buf_error(struct for (i = 0; i < entry->seg_count; i++) { drm_pci_free(dev, entry->seglist[i]); } - free(entry->seglist, M_DRM); + free(entry->seglist, DRM_MEM_SEGS); entry->seg_count = 0; } if (entry->buf_count) { for (i = 0; i < entry->buf_count; i++) { - free(entry->buflist[i].dev_private, M_DRM); + free(entry->buflist[i].dev_private, DRM_MEM_BUFS); } - free(entry->buflist, M_DRM); + free(entry->buflist, DRM_MEM_BUFS); entry->buf_count = 0; } @@ -450,7 +450,7 @@ static int drm_do_addbufs_agp(struct drm entry = &dma->bufs[order]; - entry->buflist = malloc(count * sizeof(*entry->buflist), M_DRM, + entry->buflist = malloc(count * sizeof(*entry->buflist), DRM_MEM_BUFS, M_NOWAIT | M_ZERO); if (!entry->buflist) { return ENOMEM; @@ -476,7 +476,7 @@ static int drm_do_addbufs_agp(struct drm buf->file_priv = NULL; buf->dev_priv_size = dev->driver->buf_priv_size; - buf->dev_private = malloc(buf->dev_priv_size, M_DRM, + buf->dev_private = malloc(buf->dev_priv_size, DRM_MEM_BUFS, M_NOWAIT | M_ZERO); if (buf->dev_private == NULL) { /* Set count correctly so we free the proper amount. */ @@ -493,8 +493,8 @@ static int drm_do_addbufs_agp(struct drm DRM_DEBUG("byte_count: %d\n", byte_count); temp_buflist = realloc(dma->buflist, - (dma->buf_count + entry->buf_count) * sizeof(*dma->buflist), M_DRM, - M_NOWAIT); + (dma->buf_count + entry->buf_count) * sizeof(*dma->buflist), + DRM_MEM_BUFS, M_NOWAIT); if (temp_buflist == NULL) { /* Free the entry because it isn't valid */ drm_cleanup_buf_error(dev, entry); @@ -552,22 +552,22 @@ static int drm_do_addbufs_pci(struct drm entry = &dma->bufs[order]; - entry->buflist = malloc(count * sizeof(*entry->buflist), M_DRM, + entry->buflist = malloc(count * sizeof(*entry->buflist), DRM_MEM_BUFS, M_NOWAIT | M_ZERO); - entry->seglist = malloc(count * sizeof(*entry->seglist), M_DRM, + entry->seglist = malloc(count * sizeof(*entry->seglist), DRM_MEM_SEGS, M_NOWAIT | M_ZERO); /* Keep the original pagelist until we know all the allocations * have succeeded */ temp_pagelist = malloc((dma->page_count + (count << page_order)) * - sizeof(*dma->pagelist), M_DRM, M_NOWAIT); + sizeof(*dma->pagelist), DRM_MEM_PAGES, M_NOWAIT); if (entry->buflist == NULL || entry->seglist == NULL || temp_pagelist == NULL) { - free(temp_pagelist, M_DRM); - free(entry->seglist, M_DRM); - free(entry->buflist, M_DRM); + free(temp_pagelist, DRM_MEM_PAGES); + free(entry->seglist, DRM_MEM_SEGS); + free(entry->buflist, DRM_MEM_BUFS); return ENOMEM; } @@ -592,7 +592,7 @@ static int drm_do_addbufs_pci(struct drm entry->buf_count = count; entry->seg_count = count; drm_cleanup_buf_error(dev, entry); - free(temp_pagelist, M_DRM); + free(temp_pagelist, DRM_MEM_PAGES); return ENOMEM; } @@ -620,14 +620,14 @@ static int drm_do_addbufs_pci(struct drm buf->file_priv = NULL; buf->dev_priv_size = dev->driver->buf_priv_size; - buf->dev_private = malloc(buf->dev_priv_size, M_DRM, - M_NOWAIT | M_ZERO); + buf->dev_private = malloc(buf->dev_priv_size, + DRM_MEM_BUFS, M_NOWAIT | M_ZERO); if (buf->dev_private == NULL) { /* Set count correctly so we free the proper amount. */ entry->buf_count = count; entry->seg_count = count; drm_cleanup_buf_error(dev, entry); - free(temp_pagelist, M_DRM); + free(temp_pagelist, DRM_MEM_PAGES); return ENOMEM; } @@ -638,12 +638,12 @@ static int drm_do_addbufs_pci(struct drm } temp_buflist = realloc(dma->buflist, - (dma->buf_count + entry->buf_count) * sizeof(*dma->buflist), M_DRM, - M_NOWAIT); + (dma->buf_count + entry->buf_count) * sizeof(*dma->buflist), + DRM_MEM_BUFS, M_NOWAIT); if (temp_buflist == NULL) { /* Free the entry because it isn't valid */ drm_cleanup_buf_error(dev, entry); - free(temp_pagelist, M_DRM); + free(temp_pagelist, DRM_MEM_PAGES); return ENOMEM; } dma->buflist = temp_buflist; @@ -655,7 +655,7 @@ static int drm_do_addbufs_pci(struct drm /* No allocations failed, so now we can replace the orginal pagelist * with the new one. */ - free(dma->pagelist, M_DRM); + free(dma->pagelist, DRM_MEM_PAGES); dma->pagelist = temp_pagelist; dma->buf_count += entry->buf_count; @@ -709,7 +709,7 @@ static int drm_do_addbufs_sg(struct drm_ entry = &dma->bufs[order]; - entry->buflist = malloc(count * sizeof(*entry->buflist), M_DRM, + entry->buflist = malloc(count * sizeof(*entry->buflist), DRM_MEM_BUFS, M_NOWAIT | M_ZERO); if (entry->buflist == NULL) return ENOMEM; @@ -734,7 +734,7 @@ static int drm_do_addbufs_sg(struct drm_ buf->file_priv = NULL; buf->dev_priv_size = dev->driver->buf_priv_size; - buf->dev_private = malloc(buf->dev_priv_size, M_DRM, + buf->dev_private = malloc(buf->dev_priv_size, DRM_MEM_BUFS, M_NOWAIT | M_ZERO); if (buf->dev_private == NULL) { /* Set count correctly so we free the proper amount. */ @@ -754,8 +754,8 @@ static int drm_do_addbufs_sg(struct drm_ DRM_DEBUG("byte_count: %d\n", byte_count); temp_buflist = realloc(dma->buflist, - (dma->buf_count + entry->buf_count) * sizeof(*dma->buflist), M_DRM, - M_NOWAIT); + (dma->buf_count + entry->buf_count) * sizeof(*dma->buflist), + DRM_MEM_BUFS, M_NOWAIT); if (temp_buflist == NULL) { /* Free the entry because it isn't valid */ drm_cleanup_buf_error(dev, entry); Modified: head/sys/dev/drm/drm_context.c ============================================================================== --- head/sys/dev/drm/drm_context.c Mon Oct 13 17:52:41 2008 (r183832) +++ head/sys/dev/drm/drm_context.c Mon Oct 13 18:03:27 2008 (r183833) @@ -80,7 +80,7 @@ int drm_ctxbitmap_next(struct drm_device ctx_sareas = realloc(dev->context_sareas, dev->max_context * sizeof(*dev->context_sareas), - M_DRM, M_NOWAIT); + DRM_MEM_SAREA, M_NOWAIT); if (ctx_sareas == NULL) { clear_bit(bit, dev->ctx_bitmap); DRM_UNLOCK(); @@ -91,7 +91,8 @@ int drm_ctxbitmap_next(struct drm_device } else { /* max_context == 1 at this point */ dev->context_sareas = malloc(dev->max_context * - sizeof(*dev->context_sareas), M_DRM, M_NOWAIT); + sizeof(*dev->context_sareas), DRM_MEM_SAREA, + M_NOWAIT); if (dev->context_sareas == NULL) { clear_bit(bit, dev->ctx_bitmap); DRM_UNLOCK(); @@ -110,7 +111,8 @@ int drm_ctxbitmap_init(struct drm_device int temp; DRM_LOCK(); - dev->ctx_bitmap = malloc(PAGE_SIZE, M_DRM, M_NOWAIT | M_ZERO); + dev->ctx_bitmap = malloc(PAGE_SIZE, DRM_MEM_CTXBITMAP, + M_NOWAIT | M_ZERO); if (dev->ctx_bitmap == NULL) { DRM_UNLOCK(); return ENOMEM; @@ -131,8 +133,8 @@ void drm_ctxbitmap_cleanup(struct drm_de { DRM_LOCK(); if (dev->context_sareas != NULL) - free(dev->context_sareas, M_DRM); - free(dev->ctx_bitmap, M_DRM); + free(dev->context_sareas, DRM_MEM_SAREA); + free(dev->ctx_bitmap, DRM_MEM_CTXBITMAP); DRM_UNLOCK(); } Modified: head/sys/dev/drm/drm_dma.c ============================================================================== --- head/sys/dev/drm/drm_dma.c Mon Oct 13 17:52:41 2008 (r183832) +++ head/sys/dev/drm/drm_dma.c Mon Oct 13 18:03:27 2008 (r183833) @@ -44,7 +44,7 @@ __FBSDID("$FreeBSD$"); int drm_dma_setup(struct drm_device *dev) { - dev->dma = malloc(sizeof(*dev->dma), M_DRM, M_NOWAIT | M_ZERO); + dev->dma = malloc(sizeof(*dev->dma), DRM_MEM_DRIVER, M_NOWAIT | M_ZERO); if (dev->dma == NULL) return ENOMEM; @@ -70,21 +70,21 @@ void drm_dma_takedown(struct drm_device for (j = 0; j < dma->bufs[i].seg_count; j++) { drm_pci_free(dev, dma->bufs[i].seglist[j]); } - free(dma->bufs[i].seglist, M_DRM); + free(dma->bufs[i].seglist, DRM_MEM_SEGS); } if (dma->bufs[i].buf_count) { for (j = 0; j < dma->bufs[i].buf_count; j++) { free(dma->bufs[i].buflist[j].dev_private, - M_DRM); + DRM_MEM_BUFS); } - free(dma->bufs[i].buflist, M_DRM); + free(dma->bufs[i].buflist, DRM_MEM_BUFS); } } - free(dma->buflist, M_DRM); - free(dma->pagelist, M_DRM); - free(dev->dma, M_DRM); + free(dma->buflist, DRM_MEM_BUFS); + free(dma->pagelist, DRM_MEM_PAGES); + free(dev->dma, DRM_MEM_DRIVER); dev->dma = NULL; DRM_SPINUNINIT(&dev->dma_lock); } Modified: head/sys/dev/drm/drm_drv.c ============================================================================== --- head/sys/dev/drm/drm_drv.c Mon Oct 13 17:52:41 2008 (r183832) +++ head/sys/dev/drm/drm_drv.c Mon Oct 13 18:03:27 2008 (r183833) @@ -283,7 +283,7 @@ static int drm_lastclose(struct drm_devi drm_irq_uninstall(dev); if (dev->unique) { - free(dev->unique, M_DRM); + free(dev->unique, DRM_MEM_DRIVER); dev->unique = NULL; dev->unique_len = 0; } @@ -291,7 +291,7 @@ static int drm_lastclose(struct drm_devi for (i = 0; i < DRM_HASH_SIZE; i++) { for (pt = dev->magiclist[i].head; pt; pt = next) { next = pt->next; - free(pt, M_DRM); + free(pt, DRM_MEM_MAGIC); } dev->magiclist[i].head = dev->magiclist[i].tail = NULL; } @@ -313,7 +313,7 @@ static int drm_lastclose(struct drm_devi if (entry->bound) drm_agp_unbind_memory(entry->handle); drm_agp_free_memory(entry->handle); - free(entry, M_DRM); + free(entry, DRM_MEM_AGPLISTS); } dev->agp->memory = NULL; @@ -482,7 +482,7 @@ static void drm_unload(struct drm_device } if (dev->agp) { - free(dev->agp, M_DRM); + free(dev->agp, DRM_MEM_AGPLISTS); dev->agp = NULL; } @@ -626,7 +626,7 @@ void drm_close(void *data) if (dev->driver->postclose != NULL) dev->driver->postclose(dev, file_priv); TAILQ_REMOVE(&dev->files, file_priv, link); - free(file_priv, M_DRM); + free(file_priv, DRM_MEM_FILES); /* ======================================================== * End inline drm_release Modified: head/sys/dev/drm/drm_fops.c ============================================================================== --- head/sys/dev/drm/drm_fops.c Mon Oct 13 17:52:41 2008 (r183832) +++ head/sys/dev/drm/drm_fops.c Mon Oct 13 18:03:27 2008 (r183833) @@ -53,14 +53,14 @@ int drm_open_helper(struct cdev *kdev, i DRM_DEBUG("pid = %d, minor = %d\n", DRM_CURRENTPID, m); - priv = malloc(sizeof(*priv), M_DRM, M_NOWAIT | M_ZERO); + priv = malloc(sizeof(*priv), DRM_MEM_FILES, M_NOWAIT | M_ZERO); if (priv == NULL) { return ENOMEM; } retcode = devfs_set_cdevpriv(priv, drm_close); if (retcode != 0) { - free(priv, M_DRM); + free(priv, DRM_MEM_FILES); return retcode; } @@ -79,7 +79,7 @@ int drm_open_helper(struct cdev *kdev, i retcode = -dev->driver->open(dev, priv); if (retcode != 0) { devfs_clear_cdevpriv(); - free(priv, M_DRM); + free(priv, DRM_MEM_FILES); DRM_UNLOCK(); return retcode; } Modified: head/sys/dev/drm/drm_ioctl.c ============================================================================== --- head/sys/dev/drm/drm_ioctl.c Mon Oct 13 17:52:41 2008 (r183832) +++ head/sys/dev/drm/drm_ioctl.c Mon Oct 13 18:03:27 2008 (r183833) @@ -72,12 +72,12 @@ int drm_setunique(struct drm_device *dev if (!u->unique_len || u->unique_len > 1024) return EINVAL; - busid = malloc(u->unique_len + 1, M_DRM, M_WAITOK); + busid = malloc(u->unique_len + 1, DRM_MEM_DRIVER, M_WAITOK); if (busid == NULL) return ENOMEM; if (DRM_COPY_FROM_USER(busid, u->unique, u->unique_len)) { - free(busid, M_DRM); + free(busid, DRM_MEM_DRIVER); return EFAULT; } busid[u->unique_len] = '\0'; @@ -87,7 +87,7 @@ int drm_setunique(struct drm_device *dev */ ret = sscanf(busid, "PCI:%d:%d:%d", &bus, &slot, &func); if (ret != 3) { - free(busid, M_DRM); + free(busid, DRM_MEM_DRIVER); return EINVAL; } domain = bus >> 8; @@ -97,7 +97,7 @@ int drm_setunique(struct drm_device *dev (bus != dev->pci_bus) || (slot != dev->pci_slot) || (func != dev->pci_func)) { - free(busid, M_DRM); + free(busid, DRM_MEM_DRIVER); return EINVAL; } @@ -128,7 +128,7 @@ drm_set_busid(struct drm_device *dev) } dev->unique_len = 20; - dev->unique = malloc(dev->unique_len + 1, M_DRM, M_NOWAIT); + dev->unique = malloc(dev->unique_len + 1, DRM_MEM_DRIVER, M_NOWAIT); if (dev->unique == NULL) { DRM_UNLOCK(); return ENOMEM; Modified: head/sys/dev/drm/drm_irq.c ============================================================================== --- head/sys/dev/drm/drm_irq.c Mon Oct 13 17:52:41 2008 (r183832) +++ head/sys/dev/drm/drm_irq.c Mon Oct 13 18:03:27 2008 (r183833) @@ -114,8 +114,7 @@ static void drm_vblank_cleanup(struct dr vblank_disable_fn((void *)dev); - drm_free(dev->vblank, sizeof(struct drm_vblank_info) * dev->num_crtcs, - DRM_MEM_DRIVER); + free(dev->vblank, DRM_MEM_DRIVER); dev->num_crtcs = 0; } @@ -128,8 +127,8 @@ int drm_vblank_init(struct drm_device *d atomic_set(&dev->vbl_signal_pending, 0); dev->num_crtcs = num_crtcs; - dev->vblank = drm_calloc(num_crtcs, sizeof(struct drm_vblank_info), - DRM_MEM_DRIVER); + dev->vblank = malloc(sizeof(struct drm_vblank_info) * num_crtcs, + DRM_MEM_DRIVER, M_NOWAIT | M_ZERO); if (!dev->vblank) goto err; @@ -432,8 +431,8 @@ int drm_wait_vblank(struct drm_device *d if (flags & _DRM_VBLANK_SIGNAL) { #if 0 /* disabled */ - drm_vbl_sig_t *vbl_sig = malloc(sizeof(drm_vbl_sig_t), M_DRM, - M_NOWAIT | M_ZERO); + drm_vbl_sig_t *vbl_sig = malloc(sizeof(drm_vbl_sig_t), + DRM_MEM_DRIVER, M_NOWAIT | M_ZERO); if (vbl_sig == NULL) return ENOMEM; Modified: head/sys/dev/drm/drm_memory.c ============================================================================== --- head/sys/dev/drm/drm_memory.c Mon Oct 13 17:52:41 2008 (r183832) +++ head/sys/dev/drm/drm_memory.c Mon Oct 13 18:03:27 2008 (r183833) @@ -41,7 +41,25 @@ __FBSDID("$FreeBSD$"); #include "dev/drm/drmP.h" -MALLOC_DEFINE(M_DRM, "drm", "DRM Data Structures"); +MALLOC_DEFINE(DRM_MEM_DMA, "drm_dma", "DRM DMA Data Structures"); +MALLOC_DEFINE(DRM_MEM_SAREA, "drm_sarea", "DRM SAREA Data Structures"); +MALLOC_DEFINE(DRM_MEM_DRIVER, "drm_driver", "DRM DRIVER Data Structures"); +MALLOC_DEFINE(DRM_MEM_MAGIC, "drm_magic", "DRM MAGIC Data Structures"); +MALLOC_DEFINE(DRM_MEM_IOCTLS, "drm_ioctls", "DRM IOCTL Data Structures"); +MALLOC_DEFINE(DRM_MEM_MAPS, "drm_maps", "DRM MAP Data Structures"); +MALLOC_DEFINE(DRM_MEM_BUFS, "drm_bufs", "DRM BUFFER Data Structures"); +MALLOC_DEFINE(DRM_MEM_SEGS, "drm_segs", "DRM SEGMENTS Data Structures"); +MALLOC_DEFINE(DRM_MEM_PAGES, "drm_pages", "DRM PAGES Data Structures"); +MALLOC_DEFINE(DRM_MEM_FILES, "drm_files", "DRM FILE Data Structures"); +MALLOC_DEFINE(DRM_MEM_QUEUES, "drm_queues", "DRM QUEUE Data Structures"); +MALLOC_DEFINE(DRM_MEM_CMDS, "drm_cmds", "DRM COMMAND Data Structures"); +MALLOC_DEFINE(DRM_MEM_MAPPINGS, "drm_mapping", "DRM MAPPING Data Structures"); +MALLOC_DEFINE(DRM_MEM_BUFLISTS, "drm_buflists", "DRM BUFLISTS Data Structures"); +MALLOC_DEFINE(DRM_MEM_AGPLISTS, "drm_agplists", "DRM AGPLISTS Data Structures"); +MALLOC_DEFINE(DRM_MEM_CTXBITMAP, "drm_ctxbitmap", + "DRM CTXBITMAP Data Structures"); +MALLOC_DEFINE(DRM_MEM_SGLISTS, "drm_sglists", "DRM SGLISTS Data Structures"); +MALLOC_DEFINE(DRM_MEM_DRAWABLE, "drm_drawable", "DRM DRAWABLE Data Structures"); void drm_mem_init(void) { @@ -51,35 +69,6 @@ void drm_mem_uninit(void) { } -void *drm_alloc(size_t size, int area) -{ - return malloc(size, M_DRM, M_NOWAIT); -} - -void *drm_calloc(size_t nmemb, size_t size, int area) -{ - return malloc(size * nmemb, M_DRM, M_NOWAIT | M_ZERO); -} - -void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area) -{ - void *pt; - - pt = malloc(size, M_DRM, M_NOWAIT); - if (pt == NULL) - return NULL; - if (oldpt && oldsize) { - memcpy(pt, oldpt, DRM_MIN(oldsize,size)); - free(oldpt, M_DRM); - } - return pt; -} - -void drm_free(void *pt, size_t size, int area) -{ - free(pt, M_DRM); -} - void *drm_ioremap_wc(struct drm_device *dev, drm_local_map_t *map) { return pmap_mapdev_attr(map->offset, map->size, PAT_WRITE_COMBINING); Modified: head/sys/dev/drm/drm_pci.c ============================================================================== --- head/sys/dev/drm/drm_pci.c Mon Oct 13 17:52:41 2008 (r183832) +++ head/sys/dev/drm/drm_pci.c Mon Oct 13 18:03:27 2008 (r183833) @@ -67,7 +67,7 @@ drm_pci_alloc(struct drm_device *dev, si return NULL; } - dmah = malloc(sizeof(drm_dma_handle_t), M_DRM, M_ZERO | M_NOWAIT); + dmah = malloc(sizeof(drm_dma_handle_t), DRM_MEM_DMA, M_ZERO | M_NOWAIT); if (dmah == NULL) return NULL; @@ -86,7 +86,7 @@ drm_pci_alloc(struct drm_device *dev, si BUS_DMA_ALLOCNOW, NULL, NULL, /* flags, lockfunc, lockfuncargs */ &dmah->tag); if (ret != 0) { - free(dmah, M_DRM); + free(dmah, DRM_MEM_DMA); return NULL; } @@ -94,7 +94,7 @@ drm_pci_alloc(struct drm_device *dev, si &dmah->map); if (ret != 0) { bus_dma_tag_destroy(dmah->tag); - free(dmah, M_DRM); + free(dmah, DRM_MEM_DMA); return NULL; } @@ -103,7 +103,7 @@ drm_pci_alloc(struct drm_device *dev, si if (ret != 0) { bus_dmamem_free(dmah->tag, dmah->vaddr, dmah->map); bus_dma_tag_destroy(dmah->tag); - free(dmah, M_DRM); + free(dmah, DRM_MEM_DMA); return NULL; } @@ -122,7 +122,7 @@ drm_pci_free(struct drm_device *dev, drm bus_dmamem_free(dmah->tag, dmah->vaddr, dmah->map); bus_dma_tag_destroy(dmah->tag); - free(dmah, M_DRM); + free(dmah, DRM_MEM_DMA); } /*@}*/ Modified: head/sys/dev/drm/drm_scatter.c ============================================================================== --- head/sys/dev/drm/drm_scatter.c Mon Oct 13 17:52:41 2008 (r183832) +++ head/sys/dev/drm/drm_scatter.c Mon Oct 13 18:03:27 2008 (r183833) @@ -43,9 +43,9 @@ __FBSDID("$FreeBSD$"); void drm_sg_cleanup(drm_sg_mem_t *entry) { - free((void *)entry->handle, M_DRM); - free(entry->busaddr, M_DRM); - free(entry, M_DRM); + free((void *)entry->handle, DRM_MEM_PAGES); + free(entry->busaddr, DRM_MEM_PAGES); + free(entry, DRM_MEM_SGLISTS); } int drm_sg_alloc(struct drm_device * dev, struct drm_scatter_gather * request) @@ -57,7 +57,7 @@ int drm_sg_alloc(struct drm_device * dev if (dev->sg) return EINVAL; - entry = malloc(sizeof(*entry), M_DRM, M_WAITOK | M_ZERO); + entry = malloc(sizeof(*entry), DRM_MEM_SGLISTS, M_WAITOK | M_ZERO); if (!entry) return ENOMEM; @@ -66,14 +66,14 @@ int drm_sg_alloc(struct drm_device * dev entry->pages = pages; - entry->busaddr = malloc(pages * sizeof(*entry->busaddr), M_DRM, + entry->busaddr = malloc(pages * sizeof(*entry->busaddr), DRM_MEM_PAGES, M_WAITOK | M_ZERO); if (!entry->busaddr) { drm_sg_cleanup(entry); return ENOMEM; } - entry->handle = (long)malloc(pages << PAGE_SHIFT, M_DRM, + entry->handle = (long)malloc(pages << PAGE_SHIFT, DRM_MEM_PAGES, M_WAITOK | M_ZERO); if (entry->handle == 0) { drm_sg_cleanup(entry); Modified: head/sys/dev/drm/drm_sysctl.c ============================================================================== --- head/sys/dev/drm/drm_sysctl.c Mon Oct 13 17:52:41 2008 (r183832) +++ head/sys/dev/drm/drm_sysctl.c Mon Oct 13 18:03:27 2008 (r183833) @@ -62,7 +62,7 @@ int drm_sysctl_init(struct drm_device *d struct sysctl_oid *top, *drioid; int i; - info = malloc(sizeof *info, M_DRM, M_WAITOK | M_ZERO); + info = malloc(sizeof *info, DRM_MEM_DRIVER, M_WAITOK | M_ZERO); if ( !info ) return 1; dev->sysctl = info; @@ -114,7 +114,7 @@ int drm_sysctl_cleanup(struct drm_device int error; error = sysctl_ctx_free( &dev->sysctl->ctx ); - free(dev->sysctl, M_DRM); + free(dev->sysctl, DRM_MEM_DRIVER); dev->sysctl = NULL; return error; @@ -172,7 +172,8 @@ static int drm_vm_info DRM_SYSCTL_HANDLE TAILQ_FOREACH(map, &dev->maplist, link) mapcount++; - tempmaps = malloc(sizeof(drm_local_map_t) * mapcount, M_DRM, M_NOWAIT); + tempmaps = malloc(sizeof(drm_local_map_t) * mapcount, DRM_MEM_DRIVER, + M_NOWAIT); if (tempmaps == NULL) { DRM_UNLOCK(); return ENOMEM; @@ -208,7 +209,7 @@ static int drm_vm_info DRM_SYSCTL_HANDLE SYSCTL_OUT(req, "", 1); done: - free(tempmaps, M_DRM); + free(tempmaps, DRM_MEM_DRIVER); return retcode; } @@ -232,7 +233,8 @@ static int drm_bufs_info DRM_SYSCTL_HAND } DRM_SPINLOCK(&dev->dma_lock); tempdma = *dma; - templists = malloc(sizeof(int) * dma->buf_count, M_DRM, M_NOWAIT); + templists = malloc(sizeof(int) * dma->buf_count, DRM_MEM_DRIVER, + M_NOWAIT); for (i = 0; i < dma->buf_count; i++) templists[i] = dma->buflist[i]->list; dma = &tempdma; @@ -264,7 +266,7 @@ static int drm_bufs_info DRM_SYSCTL_HAND SYSCTL_OUT(req, "", 1); done: - free(templists, M_DRM); + free(templists, DRM_MEM_DRIVER); return retcode; } @@ -282,7 +284,8 @@ static int drm_clients_info DRM_SYSCTL_H TAILQ_FOREACH(priv, &dev->files, link) privcount++; - tempprivs = malloc(sizeof(struct drm_file) * privcount, M_DRM, M_NOWAIT); + tempprivs = malloc(sizeof(struct drm_file) * privcount, DRM_MEM_DRIVER, + M_NOWAIT); if (tempprivs == NULL) { DRM_UNLOCK(); return ENOMEM; @@ -307,6 +310,6 @@ static int drm_clients_info DRM_SYSCTL_H SYSCTL_OUT(req, "", 1); done: - free(tempprivs, M_DRM); + free(tempprivs, DRM_MEM_DRIVER); return retcode; } Modified: head/sys/dev/drm/i915_drv.c ============================================================================== --- head/sys/dev/drm/i915_drv.c Mon Oct 13 17:52:41 2008 (r183832) +++ head/sys/dev/drm/i915_drv.c Mon Oct 13 18:03:27 2008 (r183833) @@ -112,7 +112,7 @@ i915_attach(device_t nbdev) { struct drm_device *dev = device_get_softc(nbdev); - dev->driver = malloc(sizeof(struct drm_driver_info), M_DRM, + dev->driver = malloc(sizeof(struct drm_driver_info), DRM_MEM_DRIVER, M_WAITOK | M_ZERO); i915_configure(dev); @@ -128,7 +128,7 @@ i915_detach(device_t nbdev) ret = drm_detach(nbdev); - free(dev->driver, M_DRM); + free(dev->driver, DRM_MEM_DRIVER); return ret; } Modified: head/sys/dev/drm/mach64_drv.c ============================================================================== --- head/sys/dev/drm/mach64_drv.c Mon Oct 13 17:52:41 2008 (r183832) +++ head/sys/dev/drm/mach64_drv.c Mon Oct 13 18:03:27 2008 (r183833) @@ -86,7 +86,7 @@ mach64_attach(device_t nbdev) { struct drm_device *dev = device_get_softc(nbdev); - dev->driver = malloc(sizeof(struct drm_driver_info), M_DRM, + dev->driver = malloc(sizeof(struct drm_driver_info), DRM_MEM_DRIVER, M_WAITOK | M_ZERO); mach64_configure(dev); @@ -102,7 +102,7 @@ mach64_detach(device_t nbdev) ret = drm_detach(nbdev); - free(dev->driver, M_DRM); + free(dev->driver, DRM_MEM_DRIVER); return ret; } Modified: head/sys/dev/drm/mga_drv.c ============================================================================== --- head/sys/dev/drm/mga_drv.c Mon Oct 13 17:52:41 2008 (r183832) +++ head/sys/dev/drm/mga_drv.c Mon Oct 13 18:03:27 2008 (r183833) @@ -130,7 +130,7 @@ mga_attach(device_t nbdev) { struct drm_device *dev = device_get_softc(nbdev); - dev->driver = malloc(sizeof(struct drm_driver_info), M_DRM, + dev->driver = malloc(sizeof(struct drm_driver_info), DRM_MEM_DRIVER, M_WAITOK | M_ZERO); mga_configure(dev); @@ -146,7 +146,7 @@ mga_detach(device_t nbdev) ret = drm_detach(nbdev); - free(dev->driver, M_DRM); + free(dev->driver, DRM_MEM_DRIVER); return ret; } Modified: head/sys/dev/drm/r128_drv.c ============================================================================== --- head/sys/dev/drm/r128_drv.c Mon Oct 13 17:52:41 2008 (r183832) +++ head/sys/dev/drm/r128_drv.c Mon Oct 13 18:03:27 2008 (r183833) @@ -85,7 +85,7 @@ r128_attach(device_t nbdev) { struct drm_device *dev = device_get_softc(nbdev); - dev->driver = malloc(sizeof(struct drm_driver_info), M_DRM, + dev->driver = malloc(sizeof(struct drm_driver_info), DRM_MEM_DRIVER, M_WAITOK | M_ZERO); r128_configure(dev); @@ -101,7 +101,7 @@ r128_detach(device_t nbdev) ret = drm_detach(nbdev); - free(dev->driver, M_DRM); + free(dev->driver, DRM_MEM_DRIVER); return ret; } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Mon Oct 13 18:06:34 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 51D43106568B; Mon, 13 Oct 2008 18:06:34 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3FEC18FC1E; Mon, 13 Oct 2008 18:06:34 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9DI6YDj082679; Mon, 13 Oct 2008 18:06:34 GMT (envelope-from rnoland@svn.freebsd.org) Received: (from rnoland@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9DI6Yvw082678; Mon, 13 Oct 2008 18:06:34 GMT (envelope-from rnoland@svn.freebsd.org) Message-Id: <200810131806.m9DI6Yvw082678@svn.freebsd.org> From: Robert Noland Date: Mon, 13 Oct 2008 18:06:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183834 - head/sys/dev/drm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Oct 2008 18:06:34 -0000 Author: rnoland Date: Mon Oct 13 18:06:33 2008 New Revision: 183834 URL: http://svn.freebsd.org/changeset/base/183834 Log: Correct memory leak of info->rects. Previously we would free info, but but abandon info->rects. Approved by: jhb (mentor) Modified: head/sys/dev/drm/drm_drawable.c Modified: head/sys/dev/drm/drm_drawable.c ============================================================================== --- head/sys/dev/drm/drm_drawable.c Mon Oct 13 18:03:27 2008 (r183833) +++ head/sys/dev/drm/drm_drawable.c Mon Oct 13 18:06:33 2008 (r183834) @@ -74,8 +74,8 @@ int drm_adddraw(struct drm_device *dev, struct drm_draw *draw = data; struct bsd_drm_drawable_info *info; - info = drm_calloc(1, sizeof(struct bsd_drm_drawable_info), - DRM_MEM_DRAWABLE); + info = malloc(sizeof(struct bsd_drm_drawable_info), DRM_MEM_DRAWABLE, + M_NOWAIT | M_ZERO); if (info == NULL) return ENOMEM; @@ -102,8 +102,8 @@ int drm_rmdraw(struct drm_device *dev, v (struct bsd_drm_drawable_info *)info); DRM_SPINUNLOCK(&dev->drw_lock); free_unr(dev->drw_unrhdr, draw->handle); - drm_free(info, sizeof(struct bsd_drm_drawable_info), - DRM_MEM_DRAWABLE); + free(info->rects, DRM_MEM_DRAWABLE); + free(info, DRM_MEM_DRAWABLE); return 0; } else { DRM_SPINUNLOCK(&dev->drw_lock); @@ -126,9 +126,7 @@ int drm_update_draw(struct drm_device *d case DRM_DRAWABLE_CLIPRECTS: DRM_SPINLOCK(&dev->drw_lock); if (update->num != info->num_rects) { - drm_free(info->rects, - sizeof(*info->rects) * info->num_rects, - DRM_MEM_DRAWABLE); + free(info->rects, DRM_MEM_DRAWABLE); info->rects = NULL; info->num_rects = 0; } @@ -137,8 +135,8 @@ int drm_update_draw(struct drm_device *d return 0; } if (info->rects == NULL) { - info->rects = drm_alloc(sizeof(*info->rects) * - update->num, DRM_MEM_DRAWABLE); + info->rects = malloc(sizeof(*info->rects) * + update->num, DRM_MEM_DRAWABLE, M_NOWAIT); if (info->rects == NULL) { DRM_SPINUNLOCK(&dev->drw_lock); return ENOMEM; @@ -167,8 +165,8 @@ void drm_drawable_free_all(struct drm_de (struct bsd_drm_drawable_info *)info); DRM_SPINUNLOCK(&dev->drw_lock); free_unr(dev->drw_unrhdr, info->handle); - drm_free(info, sizeof(struct bsd_drm_drawable_info), - DRM_MEM_DRAWABLE); + free(info->info.rects, DRM_MEM_DRAWABLE); + free(info, DRM_MEM_DRAWABLE); DRM_SPINLOCK(&dev->drw_lock); } DRM_SPINUNLOCK(&dev->drw_lock); From owner-svn-src-head@FreeBSD.ORG Mon Oct 13 18:16:55 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9D6871065688; Mon, 13 Oct 2008 18:16:55 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8A5838FC22; Mon, 13 Oct 2008 18:16:55 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9DIGtft082941; Mon, 13 Oct 2008 18:16:55 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9DIGtbT082936; Mon, 13 Oct 2008 18:16:55 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <200810131816.m9DIGtbT082936@svn.freebsd.org> From: Rafal Jaworowski Date: Mon, 13 Oct 2008 18:16:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183835 - in head/sys/arm: arm include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Oct 2008 18:16:55 -0000 Author: raj Date: Mon Oct 13 18:16:54 2008 New Revision: 183835 URL: http://svn.freebsd.org/changeset/base/183835 Log: Introduce low-level support for new Marvell core CPUs: 88FR131, 88FR571. They are compliant with ARMv5TE and integrated on 88F6281 (Kirkwood) and MV78100 (Discovery) system-on-chip families. Obtained from: Marvell, Semihalf Added: head/sys/arm/arm/cpufunc_asm_feroceon.S (contents, props changed) Modified: head/sys/arm/arm/cpufunc.c head/sys/arm/arm/identcpu.c head/sys/arm/include/armreg.h head/sys/arm/include/cpufunc.h Modified: head/sys/arm/arm/cpufunc.c ============================================================================== --- head/sys/arm/arm/cpufunc.c Mon Oct 13 18:06:33 2008 (r183834) +++ head/sys/arm/arm/cpufunc.c Mon Oct 13 18:16:54 2008 (r183835) @@ -357,6 +357,66 @@ struct cpu_functions armv5_ec_cpufuncs = arm10_setup /* cpu setup */ }; + +struct cpu_functions feroceon_cpufuncs = { + /* CPU functions */ + + cpufunc_id, /* id */ + cpufunc_nullop, /* cpwait */ + + /* MMU functions */ + + cpufunc_control, /* control */ + cpufunc_domains, /* Domain */ + feroceon_setttb, /* Setttb */ + cpufunc_faultstatus, /* Faultstatus */ + cpufunc_faultaddress, /* Faultaddress */ + + /* TLB functions */ + + armv4_tlb_flushID, /* tlb_flushID */ + arm10_tlb_flushID_SE, /* tlb_flushID_SE */ + armv4_tlb_flushI, /* tlb_flushI */ + arm10_tlb_flushI_SE, /* tlb_flushI_SE */ + armv4_tlb_flushD, /* tlb_flushD */ + armv4_tlb_flushD_SE, /* tlb_flushD_SE */ + + /* Cache operations */ + + armv5_ec_icache_sync_all, /* icache_sync_all */ + armv5_ec_icache_sync_range, /* icache_sync_range */ + + armv5_ec_dcache_wbinv_all, /* dcache_wbinv_all */ + feroceon_dcache_wbinv_range, /* dcache_wbinv_range */ + feroceon_dcache_inv_range, /* dcache_inv_range */ + feroceon_dcache_wb_range, /* dcache_wb_range */ + + armv5_ec_idcache_wbinv_all, /* idcache_wbinv_all */ + feroceon_idcache_wbinv_range, /* idcache_wbinv_all */ + + feroceon_l2cache_wbinv_all, /* l2cache_wbinv_all */ + feroceon_l2cache_wbinv_range, /* l2cache_wbinv_range */ + feroceon_l2cache_inv_range, /* l2cache_inv_range */ + feroceon_l2cache_wb_range, /* l2cache_wb_range */ + + /* Other functions */ + + cpufunc_nullop, /* flush_prefetchbuf */ + armv4_drain_writebuf, /* drain_writebuf */ + cpufunc_nullop, /* flush_brnchtgt_C */ + (void *)cpufunc_nullop, /* flush_brnchtgt_E */ + + (void *)cpufunc_nullop, /* sleep */ + + /* Soft functions */ + + cpufunc_null_fixup, /* dataabt_fixup */ + cpufunc_null_fixup, /* prefetchabt_fixup */ + + arm10_context_switch, /* context_switch */ + + arm10_setup /* cpu setup */ +}; #endif /* CPU_ARM9E || CPU_ARM10 */ #ifdef CPU_ARM10 @@ -933,9 +993,36 @@ set_cpufuncs() } #endif /* CPU_ARM9 */ #if defined(CPU_ARM9E) || defined(CPU_ARM10) - if (cputype == CPU_ID_ARM926EJS || - cputype == CPU_ID_ARM1026EJS) { - cpufuncs = armv5_ec_cpufuncs; + if (cputype == CPU_ID_ARM926EJS || cputype == CPU_ID_ARM1026EJS || + cputype == CPU_ID_MV88FR131 || cputype == CPU_ID_MV88FR571_VD || + cputype == CPU_ID_MV88FR571_41) { + if (cputype == CPU_ID_MV88FR131 || + cputype == CPU_ID_MV88FR571_VD || + cputype == CPU_ID_MV88FR571_41) { + + cpufuncs = feroceon_cpufuncs; + /* + * Workaround for Marvell MV78100 CPU: Cache prefetch + * mechanism may affect the cache coherency validity, + * so it needs to be disabled. + * + * Refer to errata document MV-S501058-00C.pdf (p. 3.1 + * L2 Prefetching Mechanism) for details. + */ + if (cputype == CPU_ID_MV88FR571_VD || + cputype == CPU_ID_MV88FR571_41) { + feroceon_control_ext(0xffffffff, + FC_DCACHE_STREAM_EN | FC_WR_ALLOC_EN | + FC_BRANCH_TARG_BUF_DIS | FC_L2CACHE_EN | + FC_L2_PREF_DIS); + } else { + feroceon_control_ext(0xffffffff, + FC_DCACHE_STREAM_EN | FC_WR_ALLOC_EN | + FC_BRANCH_TARG_BUF_DIS | FC_L2CACHE_EN); + } + } else + cpufuncs = armv5_ec_cpufuncs; + cpu_reset_needs_v4_MMU_disable = 1; /* V4 or higher */ get_cachetype_cp15(); pmap_pte_init_generic(); Added: head/sys/arm/arm/cpufunc_asm_feroceon.S ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/arm/cpufunc_asm_feroceon.S Mon Oct 13 18:16:54 2008 (r183835) @@ -0,0 +1,386 @@ +/*- + * Copyright (C) 2008 MARVELL INTERNATIONAL LTD. + * All rights reserved. + * + * Developed by Semihalf. + * + * 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. + * 3. Neither the name of MARVELL nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY 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 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 + +.Lferoceon_cache_line_size: + .word _C_LABEL(arm_pdcache_line_size) +.Lferoceon_asm_page_mask: + .word _C_LABEL(PAGE_MASK) + +ENTRY(feroceon_setttb) + /* Disable irqs */ + mrs r2, cpsr + orr r3, r2, #I32_bit | F32_bit + msr cpsr_c, r3 + + mov r1, #0 + mcr p15, 0, r1, c7, c5, 0 /* Invalidate ICache */ +1: mrc p15, 0, r15, c7, c14, 3 /* Test, clean and invalidate DCache */ + bne 1b /* More to do? */ + + mcr p15, 1, r1, c15, c9, 0 /* Clean L2 */ + mcr p15, 1, r1, c15, c11, 0 /* Invalidate L2 */ + + /* Reenable irqs */ + msr cpsr_c, r2 + + mcr p15, 0, r1, c7, c10, 4 /* drain the write buffer */ + + mcr p15, 0, r0, c2, c0, 0 /* load new TTB */ + + mcr p15, 0, r0, c8, c7, 0 /* invalidate I+D TLBs */ + RET + +ENTRY(feroceon_dcache_wbinv_range) + str lr, [sp, #-4]! + mrs lr, cpsr + /* Start with cache line aligned address */ + ldr ip, .Lferoceon_cache_line_size + ldr ip, [ip] + sub ip, ip, #1 + and r2, r0, ip + add r1, r1, r2 + add r1, r1, ip + bics r1, r1, ip + bics r0, r0, ip + + ldr ip, .Lferoceon_asm_page_mask + and r2, r0, ip + rsb r2, r2, #PAGE_SIZE + cmp r1, r2 + movcc ip, r1 + movcs ip, r2 +1: + add r3, r0, ip + sub r2, r3, #1 + /* Disable irqs */ + orr r3, lr, #I32_bit | F32_bit + msr cpsr_c, r3 + mcr p15, 5, r0, c15, c15, 0 /* Clean and inv zone start address */ + mcr p15, 5, r2, c15, c15, 1 /* Clean and inv zone end address */ + /* Enable irqs */ + msr cpsr_c, lr + + add r0, r0, ip + sub r1, r1, ip + cmp r1, #PAGE_SIZE + movcc ip, r1 + movcs ip, #PAGE_SIZE + cmp r1, #0 + bne 1b + mov r0, #0 + mcr p15, 0, r0, c7, c10, 4 /* drain the write buffer */ + ldr lr, [sp], #4 + RET + +ENTRY(feroceon_idcache_wbinv_range) + str lr, [sp, #-4]! + mrs lr, cpsr + /* Start with cache line aligned address */ + ldr ip, .Lferoceon_cache_line_size + ldr ip, [ip] + sub ip, ip, #1 + and r2, r0, ip + add r1, r1, r2 + add r1, r1, ip + bics r1, r1, ip + bics r0, r0, ip + + ldr ip, .Lferoceon_asm_page_mask + and r2, r0, ip + rsb r2, r2, #PAGE_SIZE + cmp r1, r2 + movcc ip, r1 + movcs ip, r2 +1: + add r3, r0, ip + sub r2, r3, #1 + /* Disable irqs */ + orr r3, lr, #I32_bit | F32_bit + msr cpsr_c, r3 + mcr p15, 5, r0, c15, c15, 0 /* Clean and inv zone start address */ + mcr p15, 5, r2, c15, c15, 1 /* Clean and inv zone end address */ + /* Enable irqs */ + msr cpsr_c, lr + + /* Invalidate and clean icache line by line */ + ldr r3, .Lferoceon_cache_line_size + ldr r3, [r3] +2: + mcr p15, 0, r0, c7, c5, 1 + add r0, r0, r3 + cmp r2, r0 + bhi 2b + + add r0, r2, #1 + sub r1, r1, ip + cmp r1, #PAGE_SIZE + movcc ip, r1 + movcs ip, #PAGE_SIZE + cmp r1, #0 + bne 1b + mov r0, #0 + mcr p15, 0, r0, c7, c10, 4 /* drain the write buffer */ + ldr lr, [sp], #4 + RET + +ENTRY(feroceon_dcache_inv_range) + str lr, [sp, #-4]! + mrs lr, cpsr + /* Start with cache line aligned address */ + ldr ip, .Lferoceon_cache_line_size + ldr ip, [ip] + sub ip, ip, #1 + and r2, r0, ip + add r1, r1, r2 + add r1, r1, ip + bics r1, r1, ip + bics r0, r0, ip + + ldr ip, .Lferoceon_asm_page_mask + and r2, r0, ip + rsb r2, r2, #PAGE_SIZE + cmp r1, r2 + movcc ip, r1 + movcs ip, r2 +1: + add r3, r0, ip + sub r2, r3, #1 + /* Disable irqs */ + orr r3, lr, #I32_bit | F32_bit + msr cpsr_c, r3 + mcr p15, 5, r0, c15, c14, 0 /* Inv zone start address */ + mcr p15, 5, r2, c15, c14, 1 /* Inv zone end address */ + /* Enable irqs */ + msr cpsr_c, lr + + add r0, r0, ip + sub r1, r1, ip + cmp r1, #PAGE_SIZE + movcc ip, r1 + movcs ip, #PAGE_SIZE + cmp r1, #0 + bne 1b + mov r0, #0 + mcr p15, 0, r0, c7, c10, 4 /* drain the write buffer */ + ldr lr, [sp], #4 + RET + +ENTRY(feroceon_dcache_wb_range) + str lr, [sp, #-4]! + mrs lr, cpsr + /* Start with cache line aligned address */ + ldr ip, .Lferoceon_cache_line_size + ldr ip, [ip] + sub ip, ip, #1 + and r2, r0, ip + add r1, r1, r2 + add r1, r1, ip + bics r1, r1, ip + bics r0, r0, ip + + ldr ip, .Lferoceon_asm_page_mask + and r2, r0, ip + rsb r2, r2, #PAGE_SIZE + cmp r1, r2 + movcc ip, r1 + movcs ip, r2 +1: + add r3, r0, ip + sub r2, r3, #1 + /* Disable irqs */ + orr r3, lr, #I32_bit | F32_bit + msr cpsr_c, r3 + mcr p15, 5, r0, c15, c13, 0 /* Clean zone start address */ + mcr p15, 5, r2, c15, c13, 1 /* Clean zone end address */ + /* Enable irqs */ + msr cpsr_c, lr + + add r0, r0, ip + sub r1, r1, ip + cmp r1, #PAGE_SIZE + movcc ip, r1 + movcs ip, #PAGE_SIZE + cmp r1, #0 + bne 1b + mov r0, #0 + mcr p15, 0, r0, c7, c10, 4 /* drain the write buffer */ + ldr lr, [sp], #4 + RET + +ENTRY(feroceon_l2cache_wbinv_range) + str lr, [sp, #-4]! + mrs lr, cpsr + /* Start with cache line aligned address */ + ldr ip, .Lferoceon_cache_line_size + ldr ip, [ip] + sub ip, ip, #1 + and r2, r0, ip + add r1, r1, r2 + add r1, r1, ip + bics r1, r1, ip + bics r0, r0, ip + + ldr ip, .Lferoceon_asm_page_mask + and r2, r0, ip + rsb r2, r2, #PAGE_SIZE + cmp r1, r2 + movcc ip, r1 + movcs ip, r2 +1: + add r3, r0, ip + sub r2, r3, #1 + /* Disable irqs */ + orr r3, lr, #I32_bit | F32_bit + msr cpsr_c, r3 + mcr p15, 1, r0, c15, c9, 4 /* Clean L2 zone start address */ + mcr p15, 1, r2, c15, c9, 5 /* Clean L2 zone end address */ + mcr p15, 1, r0, c15, c11, 4 /* Inv L2 zone start address */ + mcr p15, 1, r2, c15, c11, 5 /* Inv L2 zone end address */ + /* Enable irqs */ + msr cpsr_c, lr + + add r0, r0, ip + sub r1, r1, ip + cmp r1, #PAGE_SIZE + movcc ip, r1 + movcs ip, #PAGE_SIZE + cmp r1, #0 + bne 1b + mov r0, #0 + mcr p15, 0, r0, c7, c10, 4 /* drain the write buffer */ + ldr lr, [sp], #4 + RET + +ENTRY(feroceon_l2cache_inv_range) + str lr, [sp, #-4]! + mrs lr, cpsr + /* Start with cache line aligned address */ + ldr ip, .Lferoceon_cache_line_size + ldr ip, [ip] + sub ip, ip, #1 + and r2, r0, ip + add r1, r1, r2 + add r1, r1, ip + bics r1, r1, ip + bics r0, r0, ip + + ldr ip, .Lferoceon_asm_page_mask + and r2, r0, ip + rsb r2, r2, #PAGE_SIZE + cmp r1, r2 + movcc ip, r1 + movcs ip, r2 +1: + add r3, r0, ip + sub r2, r3, #1 + /* Disable irqs */ + orr r3, lr, #I32_bit | F32_bit + msr cpsr_c, r3 + mcr p15, 1, r0, c15, c11, 4 /* Inv L2 zone start address */ + mcr p15, 1, r2, c15, c11, 5 /* Inv L2 zone end address */ + /* Enable irqs */ + msr cpsr_c, lr + + add r0, r0, ip + sub r1, r1, ip + cmp r1, #PAGE_SIZE + movcc ip, r1 + movcs ip, #PAGE_SIZE + cmp r1, #0 + bne 1b + mov r0, #0 + mcr p15, 0, r0, c7, c10, 4 /* drain the write buffer */ + ldr lr, [sp], #4 + RET + +ENTRY(feroceon_l2cache_wb_range) + str lr, [sp, #-4]! + mrs lr, cpsr + /* Start with cache line aligned address */ + ldr ip, .Lferoceon_cache_line_size + ldr ip, [ip] + sub ip, ip, #1 + and r2, r0, ip + add r1, r1, r2 + add r1, r1, ip + bics r1, r1, ip + bics r0, r0, ip + + ldr ip, .Lferoceon_asm_page_mask + and r2, r0, ip + rsb r2, r2, #PAGE_SIZE + cmp r1, r2 + movcc ip, r1 + movcs ip, r2 +1: + add r3, r0, ip + sub r2, r3, #1 + /* Disable irqs */ + orr r3, lr, #I32_bit | F32_bit + msr cpsr_c, r3 + mcr p15, 1, r0, c15, c9, 4 /* Clean L2 zone start address */ + mcr p15, 1, r2, c15, c9, 5 /* Clean L2 zone end address */ + /* Enable irqs */ + msr cpsr_c, lr + + add r0, r0, ip + sub r1, r1, ip + cmp r1, #PAGE_SIZE + movcc ip, r1 + movcs ip, #PAGE_SIZE + cmp r1, #0 + bne 1b + mov r0, #0 + mcr p15, 0, r0, c7, c10, 4 /* drain the write buffer */ + ldr lr, [sp], #4 + RET + +ENTRY(feroceon_l2cache_wbinv_all) + mov r0, #0 + mcr p15, 1, r0, c15, c9, 0 /* Clean L2 */ + mcr p15, 1, r0, c15, c11, 0 /* Invalidate L2 */ + mcr p15, 0, r0, c7, c10, 4 /* drain the write buffer */ + RET + +ENTRY(feroceon_control_ext) + mrc p15, 1, r3, c15, c1, 0 /* Read the control register */ + bic r2, r3, r0 /* Clear bits */ + eor r2, r2, r1 /* XOR bits */ + + teq r2, r3 /* Only write if there is a change */ + mcrne p15, 1, r2, c15, c1, 0 /* Write new control register */ + mov r0, r3 /* Return old value */ + RET Modified: head/sys/arm/arm/identcpu.c ============================================================================== --- head/sys/arm/arm/identcpu.c Mon Oct 13 18:06:33 2008 (r183834) +++ head/sys/arm/arm/identcpu.c Mon Oct 13 18:16:54 2008 (r183835) @@ -75,7 +75,8 @@ enum cpu_class { CPU_CLASS_ARM10EJ, CPU_CLASS_SA1, CPU_CLASS_XSCALE, - CPU_CLASS_ARM11J + CPU_CLASS_ARM11J, + CPU_CLASS_MARVELL }; static const char * const generic_steppings[16] = { @@ -304,6 +305,15 @@ const struct cpuidtab cpuids[] = { { CPU_ID_ARM1136JSR1, CPU_CLASS_ARM11J, "ARM1136J-S R1", generic_steppings }, + { CPU_ID_MV88FR131, CPU_CLASS_MARVELL, "Feroceon 88FR131", + generic_steppings }, + + { CPU_ID_MV88FR571_VD, CPU_CLASS_MARVELL, "Feroceon 88FR571-VD", + generic_steppings }, + + { CPU_ID_MV88FR571_41, CPU_CLASS_MARVELL, "Early Feroceon 88FR571", + generic_steppings }, + { 0, CPU_CLASS_NONE, NULL, NULL } }; Modified: head/sys/arm/include/armreg.h ============================================================================== --- head/sys/arm/include/armreg.h Mon Oct 13 18:06:33 2008 (r183834) +++ head/sys/arm/include/armreg.h Mon Oct 13 18:16:54 2008 (r183835) @@ -148,6 +148,9 @@ #define CPU_ID_SA110 0x4401a100 #define CPU_ID_SA1100 0x4401a110 #define CPU_ID_TI925T 0x54029250 +#define CPU_ID_MV88FR131 0x56251310 /* Marvell Feroceon 88FR131 Core */ +#define CPU_ID_MV88FR571_VD 0x56155710 /* Marvell Feroceon 88FR571-VD Core (ID from datasheet) */ +#define CPU_ID_MV88FR571_41 0x41159260 /* Marvell Feroceon 88FR571-VD Core (actual ID from CPU reg) */ #define CPU_ID_FA526 0x66015260 #define CPU_ID_SA1110 0x6901b110 #define CPU_ID_IXP1200 0x6901c120 @@ -253,6 +256,18 @@ /* Xscale Core 3 only */ #define XSCALE_AUXCTL_LLR 0x00000400 /* Enable L2 for LLR Cache */ +/* Marvell Feroceon Extra Features Register (CP15 register 1, opcode2 0) */ +#define FC_DCACHE_REPL_LOCK 0x80000000 /* Replace DCache Lock */ +#define FC_DCACHE_STREAM_EN 0x20000000 /* DCache Streaming Switch */ +#define FC_WR_ALLOC_EN 0x10000000 /* Enable Write Allocate */ +#define FC_L2_PREF_DIS 0x01000000 /* L2 Cache Prefetch Disable */ +#define FC_L2_INV_EVICT_LINE 0x00800000 /* L2 Invalidates Uncorrectable Error Line Eviction */ +#define FC_L2CACHE_EN 0x00400000 /* L2 enable */ +#define FC_ICACHE_REPL_LOCK 0x00080000 /* Replace ICache Lock */ +#define FC_GLOB_HIST_REG_EN 0x00040000 /* Branch Global History Register Enable */ +#define FC_BRANCH_TARG_BUF_DIS 0x00020000 /* Branch Target Buffer Disable */ +#define FC_L1_PAR_ERR_EN 0x00010000 /* L1 Parity Error Enable */ + /* Cache type register definitions */ #define CPU_CT_ISIZE(x) ((x) & 0xfff) /* I$ info */ #define CPU_CT_DSIZE(x) (((x) >> 12) & 0xfff) /* D$ info */ Modified: head/sys/arm/include/cpufunc.h ============================================================================== --- head/sys/arm/include/cpufunc.h Mon Oct 13 18:06:33 2008 (r183834) +++ head/sys/arm/include/cpufunc.h Mon Oct 13 18:16:54 2008 (r183835) @@ -376,6 +376,18 @@ extern unsigned arm10_dcache_sets_max; extern unsigned arm10_dcache_sets_inc; extern unsigned arm10_dcache_index_max; extern unsigned arm10_dcache_index_inc; + +u_int feroceon_control_ext (u_int, u_int); +void feroceon_setttb (u_int); +void feroceon_dcache_wbinv_range (vm_offset_t, vm_size_t); +void feroceon_dcache_inv_range (vm_offset_t, vm_size_t); +void feroceon_dcache_wb_range (vm_offset_t, vm_size_t); +void feroceon_idcache_wbinv_range (vm_offset_t, vm_size_t); + +void feroceon_l2cache_wbinv_range (vm_offset_t, vm_size_t); +void feroceon_l2cache_inv_range (vm_offset_t, vm_size_t); +void feroceon_l2cache_wb_range (vm_offset_t, vm_size_t); +void feroceon_l2cache_wbinv_all (void); #endif #ifdef CPU_ARM11 From owner-svn-src-head@FreeBSD.ORG Mon Oct 13 18:42:25 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B8393106568B; Mon, 13 Oct 2008 18:42:25 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A6F498FC26; Mon, 13 Oct 2008 18:42:25 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9DIgPVn083454; Mon, 13 Oct 2008 18:42:25 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9DIgPkp083453; Mon, 13 Oct 2008 18:42:25 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <200810131842.m9DIgPkp083453@svn.freebsd.org> From: Rafal Jaworowski Date: Mon, 13 Oct 2008 18:42:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183836 - head/sys/arm/arm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Oct 2008 18:42:25 -0000 Author: raj Date: Mon Oct 13 18:42:25 2008 New Revision: 183836 URL: http://svn.freebsd.org/changeset/base/183836 Log: Do not use cached page for temporary mapping in pmap_zero_page_generic() The physical page which we clear is accessed via additional temp kernel mapping for the period of zeroing operation. However in systems with virtual d-cache (most ARMs) when write-allocate feature is enabled, we can have modified but unflushed content pertaining to this physical page still in the d-cache due to its primary (pre-existing) mapping. In such scenario that cached content upon flush is likely to overwrite [portions of] the physical page we want to zero here.. This is a general problem with multiple virtual mappings covering the same physical page with write-allocate and virtual d-cache: there is inherent potential for corruptions of this kind, which are not easily resolved; it is best policy that such multiple mappings be not allowed. Obtained from: Marvell, Semihalf Modified: head/sys/arm/arm/pmap.c Modified: head/sys/arm/arm/pmap.c ============================================================================== --- head/sys/arm/arm/pmap.c Mon Oct 13 18:16:54 2008 (r183835) +++ head/sys/arm/arm/pmap.c Mon Oct 13 18:42:25 2008 (r183836) @@ -3850,21 +3850,19 @@ pmap_zero_page_generic(vm_paddr_t phys, mtx_lock(&cmtx); /* - * Hook in the page, zero it, and purge the cache for that - * zeroed page. Invalidate the TLB as needed. + * Hook in the page, zero it, invalidate the TLB as needed. + * + * Note the temporary zero-page mapping must be a non-cached page in + * ordert to work without corruption when write-allocate is enabled. */ - *cdst_pte = L2_S_PROTO | phys | - L2_S_PROT(PTE_KERNEL, VM_PROT_WRITE) | pte_l2_s_cache_mode; - PTE_SYNC(cdst_pte); + *cdst_pte = L2_S_PROTO | phys | L2_S_PROT(PTE_KERNEL, VM_PROT_WRITE); cpu_tlb_flushD_SE(cdstp); cpu_cpwait(); - if (off || size != PAGE_SIZE) { + if (off || size != PAGE_SIZE) bzero((void *)(cdstp + off), size); - cpu_dcache_wbinv_range(cdstp + off, size); - } else { + else bzero_page(cdstp); - cpu_dcache_wbinv_range(cdstp, PAGE_SIZE); - } + mtx_unlock(&cmtx); #endif } From owner-svn-src-head@FreeBSD.ORG Mon Oct 13 18:59:59 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EBC6A1065686; Mon, 13 Oct 2008 18:59:59 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D94568FC1A; Mon, 13 Oct 2008 18:59:59 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9DIxxho083835; Mon, 13 Oct 2008 18:59:59 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9DIxxgw083830; Mon, 13 Oct 2008 18:59:59 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <200810131859.m9DIxxgw083830@svn.freebsd.org> From: Rafal Jaworowski Date: Mon, 13 Oct 2008 18:59:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183838 - head/sys/arm/arm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Oct 2008 19:00:00 -0000 Author: raj Date: Mon Oct 13 18:59:59 2008 New Revision: 183838 URL: http://svn.freebsd.org/changeset/base/183838 Log: Provide L2 cache synchronization (write back + invalidation) on ARM. Note the cpu_l2cache_wbinv_* routines are no-ops on systems not populated with L2 caches. Obtained from: Marvell, Semihalf Modified: head/sys/arm/arm/busdma_machdep.c head/sys/arm/arm/elf_machdep.c head/sys/arm/arm/genassym.c head/sys/arm/arm/pmap.c head/sys/arm/arm/swtch.S Modified: head/sys/arm/arm/busdma_machdep.c ============================================================================== --- head/sys/arm/arm/busdma_machdep.c Mon Oct 13 18:44:59 2008 (r183837) +++ head/sys/arm/arm/busdma_machdep.c Mon Oct 13 18:59:59 2008 (r183838) @@ -629,6 +629,8 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi newmap->allocbuffer = tmpaddr; cpu_idcache_wbinv_range((vm_offset_t)*vaddr, dmat->maxsize); + cpu_l2cache_wbinv_range((vm_offset_t)*vaddr, + dmat->maxsize); *vaddr = tmpaddr; } else newmap->origbuffer = newmap->allocbuffer = NULL; Modified: head/sys/arm/arm/elf_machdep.c ============================================================================== --- head/sys/arm/arm/elf_machdep.c Mon Oct 13 18:44:59 2008 (r183837) +++ head/sys/arm/arm/elf_machdep.c Mon Oct 13 18:59:59 2008 (r183838) @@ -215,6 +215,7 @@ elf_cpu_load_file(linker_file_t lf __unu { cpu_idcache_wbinv_all(); + cpu_l2cache_wbinv_all(); cpu_tlb_flushID(); return (0); } Modified: head/sys/arm/arm/genassym.c ============================================================================== --- head/sys/arm/arm/genassym.c Mon Oct 13 18:44:59 2008 (r183837) +++ head/sys/arm/arm/genassym.c Mon Oct 13 18:59:59 2008 (r183838) @@ -79,7 +79,9 @@ ASSYM(CF_SETTTB, offsetof(struct cpu_fun ASSYM(CF_CONTROL, offsetof(struct cpu_functions, cf_control)); ASSYM(CF_CONTEXT_SWITCH, offsetof(struct cpu_functions, cf_context_switch)); ASSYM(CF_DCACHE_WB_RANGE, offsetof(struct cpu_functions, cf_dcache_wb_range)); +ASSYM(CF_L2CACHE_WB_RANGE, offsetof(struct cpu_functions, cf_l2cache_wb_range)); ASSYM(CF_IDCACHE_WBINV_ALL, offsetof(struct cpu_functions, cf_idcache_wbinv_all)); +ASSYM(CF_L2CACHE_WBINV_ALL, offsetof(struct cpu_functions, cf_l2cache_wbinv_all)); ASSYM(CF_TLB_FLUSHID_SE, offsetof(struct cpu_functions, cf_tlb_flushID_SE)); ASSYM(CF_ICACHE_SYNC, offsetof(struct cpu_functions, cf_icache_sync_all)); Modified: head/sys/arm/arm/pmap.c ============================================================================== --- head/sys/arm/arm/pmap.c Mon Oct 13 18:44:59 2008 (r183837) +++ head/sys/arm/arm/pmap.c Mon Oct 13 18:59:59 2008 (r183838) @@ -151,6 +151,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1196,27 +1197,104 @@ pmap_tlb_flushD(pmap_t pm) } static PMAP_INLINE void +pmap_l2cache_wbinv_range(pmap_t pm, vm_offset_t va, vm_size_t len) +{ + vm_size_t rest; + pd_entry_t *pde; + pt_entry_t *ptep; + + rest = MIN(PAGE_SIZE - (va & PAGE_MASK), len); + + while (len > 0) { + CTR4(KTR_PMAP, "pmap_l2cache_wbinv_range: pmap %p is_kernel %d " + "va 0x%08x len 0x%x ", pm, pm == pmap_kernel(), va, rest); + if (pmap_get_pde_pte(pm, va, &pde, &ptep) && l2pte_valid(*ptep)) + cpu_l2cache_wb_range(va, rest); + + len -= rest; + va += rest; + + rest = MIN(PAGE_SIZE, len); + } +} + +static PMAP_INLINE void pmap_idcache_wbinv_range(pmap_t pm, vm_offset_t va, vm_size_t len) { - if (pmap_is_current(pm)) + if (pmap_is_current(pm)) { cpu_idcache_wbinv_range(va, len); + pmap_l2cache_wbinv_range(pm, va, len); + } +} + +static PMAP_INLINE void +pmap_l2cache_wb_range(pmap_t pm, vm_offset_t va, vm_size_t len) +{ + vm_size_t rest; + pd_entry_t *pde; + pt_entry_t *ptep; + + rest = MIN(PAGE_SIZE - (va & PAGE_MASK), len); + + while (len > 0) { + CTR4(KTR_PMAP, "pmap_l2cache_wb_range: pmap %p is_kernel %d " + "va 0x%08x len 0x%x ", pm, pm == pmap_kernel(), va, rest); + if (pmap_get_pde_pte(pm, va, &pde, &ptep) && l2pte_valid(*ptep)) + cpu_l2cache_wb_range(va, rest); + + len -= rest; + va += rest; + + rest = MIN(PAGE_SIZE, len); + } } static PMAP_INLINE void -pmap_dcache_wb_range(pmap_t pm, vm_offset_t va, vm_size_t len, - boolean_t do_inv, boolean_t rd_only) +pmap_l2cache_inv_range(pmap_t pm, vm_offset_t va, vm_size_t len) { + vm_size_t rest; + pd_entry_t *pde; + pt_entry_t *ptep; + + rest = MIN(PAGE_SIZE - (va & PAGE_MASK), len); + + while (len > 0) { + CTR4(KTR_PMAP, "pmap_l2cache_wb_range: pmap %p is_kernel %d " + "va 0x%08x len 0x%x ", pm, pm == pmap_kernel(), va, rest); + if (pmap_get_pde_pte(pm, va, &pde, &ptep) && l2pte_valid(*ptep)) + cpu_l2cache_inv_range(va, rest); + + len -= rest; + va += rest; + + rest = MIN(PAGE_SIZE, len); + } +} + +static PMAP_INLINE void +pmap_dcache_wb_range(pmap_t pm, vm_offset_t va, vm_size_t len, boolean_t do_inv, + boolean_t rd_only) +{ + CTR4(KTR_PMAP, "pmap_dcache_wb_range: pmap %p is_kernel %d va 0x%08x " + "len 0x%x ", pm, pm == pmap_kernel(), va, len); + CTR2(KTR_PMAP, " do_inv %d rd_only %d", do_inv, rd_only); if (pmap_is_current(pm)) { if (do_inv) { - if (rd_only) + if (rd_only) { cpu_dcache_inv_range(va, len); - else + pmap_l2cache_inv_range(pm, va, len); + } + else { cpu_dcache_wbinv_range(va, len); + pmap_l2cache_wbinv_range(pm, va, len); + } } else - if (!rd_only) + if (!rd_only) { cpu_dcache_wb_range(va, len); + pmap_l2cache_wb_range(pm, va, len); + } } } @@ -1224,16 +1302,20 @@ static PMAP_INLINE void pmap_idcache_wbinv_all(pmap_t pm) { - if (pmap_is_current(pm)) + if (pmap_is_current(pm)) { cpu_idcache_wbinv_all(); + cpu_l2cache_wbinv_all(); + } } static PMAP_INLINE void pmap_dcache_wbinv_all(pmap_t pm) { - if (pmap_is_current(pm)) + if (pmap_is_current(pm)) { cpu_dcache_wbinv_all(); + cpu_l2cache_wbinv_all(); + } } /* @@ -2169,6 +2251,8 @@ pmap_set_pt_cache_mode(pd_entry_t *kl1, PTE_SYNC(pdep); cpu_dcache_wbinv_range((vm_offset_t)pdep, sizeof(*pdep)); + cpu_l2cache_wbinv_range((vm_offset_t)pdep, + sizeof(*pdep)); rv = 1; } } else { @@ -2185,6 +2269,8 @@ pmap_set_pt_cache_mode(pd_entry_t *kl1, PTE_SYNC(ptep); cpu_dcache_wbinv_range((vm_offset_t)ptep, sizeof(*ptep)); + cpu_l2cache_wbinv_range((vm_offset_t)ptep, + sizeof(*ptep)); rv = 1; } } @@ -2337,6 +2423,7 @@ pmap_bootstrap(vm_offset_t firstaddr, vm } cpu_dcache_wbinv_all(); + cpu_l2cache_wbinv_all(); cpu_tlb_flushID(); cpu_cpwait(); @@ -2373,6 +2460,7 @@ pmap_bootstrap(vm_offset_t firstaddr, vm mtx_init(&l1_lru_lock, "l1 list lock", NULL, MTX_DEF); pmap_init_l1(l1, kernel_l1pt); cpu_dcache_wbinv_all(); + cpu_l2cache_wbinv_all(); virtual_avail = round_page(virtual_avail); virtual_end = lastaddr; @@ -2402,6 +2490,7 @@ pmap_release(pmap_t pmap) struct pcb *pcb; pmap_idcache_wbinv_all(pmap); + cpu_l2cache_wbinv_all(); pmap_tlb_flushID(pmap); cpu_cpwait(); if (vector_page < KERNBASE) { @@ -2589,6 +2678,7 @@ pmap_growkernel(vm_offset_t addr) * rarely */ cpu_dcache_wbinv_all(); + cpu_l2cache_wbinv_all(); cpu_tlb_flushD(); cpu_cpwait(); kernel_vm_end = pmap_curmaxkvaddr; @@ -2614,6 +2704,7 @@ pmap_remove_pages(pmap_t pmap) vm_page_lock_queues(); PMAP_LOCK(pmap); cpu_idcache_wbinv_all(); + cpu_l2cache_wbinv_all(); for (pv = TAILQ_FIRST(&pmap->pm_pvlist); pv; pv = npv) { if (pv->pv_flags & PVF_WIRED) { /* The page is wired, cannot remove it now. */ @@ -2726,6 +2817,7 @@ pmap_kenter_internal(vm_offset_t va, vm_ (uint32_t) pte, opte, *pte)); if (l2pte_valid(opte)) { cpu_dcache_wbinv_range(va, PAGE_SIZE); + cpu_l2cache_wbinv_range(va, PAGE_SIZE); cpu_tlb_flushD_SE(va); cpu_cpwait(); } else { @@ -2784,6 +2876,7 @@ pmap_kremove(vm_offset_t va) opte = *pte; if (l2pte_valid(opte)) { cpu_dcache_wbinv_range(va, PAGE_SIZE); + cpu_l2cache_wbinv_range(va, PAGE_SIZE); cpu_tlb_flushD_SE(va); cpu_cpwait(); *pte = 0; @@ -3052,6 +3145,9 @@ pmap_protect(pmap_t pm, vm_offset_t sva, u_int flags; int flush; + CTR4(KTR_PMAP, "pmap_protect: pmap %p sva 0x%08x eva 0x%08x prot %x", + pm, sva, eva, prot); + if ((prot & VM_PROT_READ) == 0) { pmap_remove(pm, sva, eva); return; @@ -3286,9 +3382,11 @@ do_l2b_alloc: */ if (pmap_is_current(pmap) && (oflags & PVF_NC) == 0 && - (opte & L2_S_PROT_W) != 0 && - (prot & VM_PROT_WRITE) == 0) + (opte & L2_S_PROT_W) != 0 && + (prot & VM_PROT_WRITE) == 0) { cpu_dcache_wb_range(va, PAGE_SIZE); + pmap_l2cache_wb_range(pmap, va, PAGE_SIZE); + } } else { /* * New mapping, or changing the backing page @@ -3777,11 +3875,15 @@ pmap_remove(pmap_t pm, vm_offset_t sva, total++; if (is_exec) { cpu_idcache_wbinv_range(sva, - PAGE_SIZE); + PAGE_SIZE); + cpu_l2cache_wbinv_range(sva, + PAGE_SIZE); cpu_tlb_flushID_SE(sva); } else if (is_refd) { cpu_dcache_wbinv_range(sva, - PAGE_SIZE); + PAGE_SIZE); + cpu_l2cache_wbinv_range(sva, + PAGE_SIZE); cpu_tlb_flushD_SE(sva); } } else if (total == PMAP_REMOVE_CLEAN_LIST_SIZE) { @@ -3789,6 +3891,7 @@ pmap_remove(pmap_t pm, vm_offset_t sva, * for a current pmap */ cpu_idcache_wbinv_all(); + cpu_l2cache_wbinv_all(); flushall = 1; total++; } @@ -3842,9 +3945,11 @@ pmap_zero_page_generic(vm_paddr_t phys, if (off || size != PAGE_SIZE) { bzero(dstpg + off, size); cpu_dcache_wbinv_range((vm_offset_t)(dstpg + off), size); + cpu_l2cache_wbinv_range((vm_offset_t)(dstpg + off), size); } else { bzero_page((vm_offset_t)dstpg); cpu_dcache_wbinv_range((vm_offset_t)dstpg, PAGE_SIZE); + cpu_l2cache_wbinv_range((vm_offset_t)dstpg, PAGE_SIZE); } #else @@ -4139,6 +4244,8 @@ pmap_copy_page_generic(vm_paddr_t src, v mtx_unlock(&cmtx); cpu_dcache_inv_range(csrcp, PAGE_SIZE); cpu_dcache_wbinv_range(cdstp, PAGE_SIZE); + cpu_l2cache_inv_range(csrcp, PAGE_SIZE); + cpu_l2cache_wbinv_range(cdstp, PAGE_SIZE); } #endif /* (ARM_MMU_GENERIC + ARM_MMU_SA1) != 0 */ @@ -4201,6 +4308,7 @@ pmap_copy_page(vm_page_t src, vm_page_t #endif cpu_dcache_wbinv_all(); + cpu_l2cache_wbinv_all(); if (_arm_memcpy && PAGE_SIZE >= _min_memcpy_size && _arm_memcpy((void *)VM_PAGE_TO_PHYS(dst), (void *)VM_PAGE_TO_PHYS(src), PAGE_SIZE, IS_PHYSICAL) == 0) @@ -4210,6 +4318,7 @@ pmap_copy_page(vm_page_t src, vm_page_t dstpg = arm_ptovirt(VM_PAGE_TO_PHYS(dst)); bcopy_page(srcpg, dstpg); cpu_dcache_wbinv_range(dstpg, PAGE_SIZE); + cpu_l2cache_wbinv_range(dstpg, PAGE_SIZE); #else pmap_copy_page_func(VM_PAGE_TO_PHYS(src), VM_PAGE_TO_PHYS(dst)); #endif Modified: head/sys/arm/arm/swtch.S ============================================================================== --- head/sys/arm/arm/swtch.S Mon Oct 13 18:44:59 2008 (r183837) +++ head/sys/arm/arm/swtch.S Mon Oct 13 18:59:59 2008 (r183838) @@ -143,6 +143,8 @@ ENTRY(cpu_throw) ldr r9, .Lcpufuncs mov lr, pc ldr pc, [r9, #CF_IDCACHE_WBINV_ALL] + mov lr, pc + ldr pc, [r9, #CF_L2CACHE_WBINV_ALL] ldr r0, [r7, #(PCB_PL1VEC)] ldr r1, [r7, #(PCB_DACR)] /* @@ -172,6 +174,8 @@ ENTRY(cpu_throw) movne r1, #4 movne lr, pc ldrne pc, [r9, #CF_DCACHE_WB_RANGE] + movne lr, pc + ldrne pc, [r9, #CF_L2CACHE_WB_RANGE] #endif /* PMAP_INCLUDE_PTE_SYNC */ /* @@ -328,6 +332,8 @@ ENTRY(cpu_switch) ldr r1, .Lcpufuncs mov lr, pc ldr pc, [r1, #CF_IDCACHE_WBINV_ALL] + mov lr, pc + ldr pc, [r1, #CF_L2CACHE_WBINV_ALL] .Lcs_cache_purge_skipped: /* rem: r6 = lock */ /* rem: r9 = new PCB */ @@ -360,6 +366,8 @@ ENTRY(cpu_switch) mov r1, #4 mov lr, pc ldr pc, [r2, #CF_DCACHE_WB_RANGE] + mov lr, pc + ldr pc, [r2, #CF_L2CACHE_WB_RANGE] .Lcs_same_vector: #endif /* PMAP_INCLUDE_PTE_SYNC */ From owner-svn-src-head@FreeBSD.ORG Mon Oct 13 19:14:14 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 825E4106568C; Mon, 13 Oct 2008 19:14:14 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 710408FC19; Mon, 13 Oct 2008 19:14:14 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9DJEEiA084116; Mon, 13 Oct 2008 19:14:14 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9DJEEJN084115; Mon, 13 Oct 2008 19:14:14 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <200810131914.m9DJEEJN084115@svn.freebsd.org> From: Rafal Jaworowski Date: Mon, 13 Oct 2008 19:14:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183839 - head/sys/arm/arm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Oct 2008 19:14:14 -0000 Author: raj Date: Mon Oct 13 19:14:14 2008 New Revision: 183839 URL: http://svn.freebsd.org/changeset/base/183839 Log: One more L2 cache synchronization call that didn't make the previous commit. Modified: head/sys/arm/arm/locore.S Modified: head/sys/arm/arm/locore.S ============================================================================== --- head/sys/arm/arm/locore.S Mon Oct 13 18:59:59 2008 (r183838) +++ head/sys/arm/arm/locore.S Mon Oct 13 19:14:14 2008 (r183839) @@ -245,6 +245,8 @@ ENTRY_NP(cpu_halt) ldr r0, .Lcpufuncs mov lr, pc ldr pc, [r0, #CF_IDCACHE_WBINV_ALL] + mov lr, pc + ldr pc, [r0, #CF_L2CACHE_WBINV_ALL] /* * Load the cpu_reset_needs_v4_MMU_disable flag to determine if it's From owner-svn-src-head@FreeBSD.ORG Mon Oct 13 20:07:13 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E3D4F106568C; Mon, 13 Oct 2008 20:07:13 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9B0BA8FC14; Mon, 13 Oct 2008 20:07:13 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9DK7DhD085097; Mon, 13 Oct 2008 20:07:13 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9DK7DwQ085091; Mon, 13 Oct 2008 20:07:13 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <200810132007.m9DK7DwQ085091@svn.freebsd.org> From: Rafal Jaworowski Date: Mon, 13 Oct 2008 20:07:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183840 - in head/sys: arm/arm arm/include arm/mv arm/mv/discovery arm/mv/kirkwood arm/mv/orion conf dev/uart X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Oct 2008 20:07:14 -0000 Author: raj Date: Mon Oct 13 20:07:13 2008 New Revision: 183840 URL: http://svn.freebsd.org/changeset/base/183840 Log: Introduce basic support for Marvell families of system-on-chip ARM devices: * Orion - 88F5181 - 88F5182 - 88F5281 * Kirkwood - 88F6281 * Discovery - MV78100 The above families of SOCs are built around CPU cores compliant with ARMv5TE instruction set architecture definition. They share a number of integrated peripherals. This commit brings support for the following basic elements: * GPIO * Interrupt controller * L1, L2 cache * Timers, watchdog, RTC * TWSI (I2C) * UART Other peripherals drivers will be introduced separately. Reviewed by: imp, marcel, stass (Thanks guys!) Obtained from: Marvell, Semihalf Added: head/sys/arm/mv/ head/sys/arm/mv/bus_space.c (contents, props changed) head/sys/arm/mv/common.c (contents, props changed) head/sys/arm/mv/discovery/ head/sys/arm/mv/discovery/db78xxx.c (contents, props changed) head/sys/arm/mv/discovery/discovery.c (contents, props changed) head/sys/arm/mv/discovery/files.db78xxx (contents, props changed) head/sys/arm/mv/discovery/std.db78xxx (contents, props changed) head/sys/arm/mv/files.mv (contents, props changed) head/sys/arm/mv/gpio.c (contents, props changed) head/sys/arm/mv/ic.c (contents, props changed) head/sys/arm/mv/kirkwood/ head/sys/arm/mv/kirkwood/db88f6xxx.c (contents, props changed) head/sys/arm/mv/kirkwood/files.db88f6xxx (contents, props changed) head/sys/arm/mv/kirkwood/kirkwood.c (contents, props changed) head/sys/arm/mv/kirkwood/std.db88f6xxx (contents, props changed) head/sys/arm/mv/mv_machdep.c (contents, props changed) head/sys/arm/mv/mvreg.h (contents, props changed) head/sys/arm/mv/mvvar.h (contents, props changed) head/sys/arm/mv/obio.c (contents, props changed) head/sys/arm/mv/orion/ head/sys/arm/mv/orion/db88f5xxx.c (contents, props changed) head/sys/arm/mv/orion/files.db88f5xxx (contents, props changed) head/sys/arm/mv/orion/orion.c (contents, props changed) head/sys/arm/mv/orion/std.db88f5xxx (contents, props changed) head/sys/arm/mv/rtc.c (contents, props changed) head/sys/arm/mv/std.mv (contents, props changed) head/sys/arm/mv/timer.c (contents, props changed) head/sys/arm/mv/twsi.c (contents, props changed) head/sys/dev/uart/uart_bus_mbus.c (contents, props changed) head/sys/dev/uart/uart_cpu_mv.c (contents, props changed) Modified: head/sys/arm/arm/elf_trampoline.c head/sys/arm/include/intr.h head/sys/arm/include/resource.h head/sys/conf/Makefile.arm head/sys/conf/options.arm Modified: head/sys/arm/arm/elf_trampoline.c ============================================================================== --- head/sys/arm/arm/elf_trampoline.c Mon Oct 13 19:14:14 2008 (r183839) +++ head/sys/arm/arm/elf_trampoline.c Mon Oct 13 20:07:13 2008 (r183840) @@ -73,6 +73,8 @@ void __startC(void); #endif #ifdef CPU_XSCALE_81342 #define cpu_l2cache_wbinv_all xscalec3_l2cache_purge +#elif defined(SOC_MV_KIRKWOOD) || defined(SOC_MV_DISCOVERY) +#define cpu_l2cache_wbinv_all feroceon_l2cache_wbinv_all #else #define cpu_l2cache_wbinv_all() #endif Modified: head/sys/arm/include/intr.h ============================================================================== --- head/sys/arm/include/intr.h Mon Oct 13 19:14:14 2008 (r183839) +++ head/sys/arm/include/intr.h Mon Oct 13 20:07:13 2008 (r183840) @@ -44,7 +44,9 @@ #elif defined(CPU_XSCALE_PXA2X0) #include #define NIRQ IRQ_GPIO_MAX -#elif defined(CPU_ARM9) +#elif defined(SOC_MV_DISCOVERY) +#define NIRQ 96 +#elif defined(CPU_ARM9) || defined(SOC_MV_KIRKWOOD) #define NIRQ 64 #else #define NIRQ 32 Modified: head/sys/arm/include/resource.h ============================================================================== --- head/sys/arm/include/resource.h Mon Oct 13 19:14:14 2008 (r183839) +++ head/sys/arm/include/resource.h Mon Oct 13 20:07:13 2008 (r183840) @@ -41,5 +41,6 @@ #define SYS_RES_DRQ 2 /* isa dma lines */ #define SYS_RES_MEMORY 3 /* i/o memory */ #define SYS_RES_IOPORT 4 /* i/o ports */ +#define SYS_RES_GPIO 5 /* general purpose i/o */ #endif /* !_MACHINE_RESOURCE_H_ */ Added: head/sys/arm/mv/bus_space.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/mv/bus_space.c Mon Oct 13 20:07:13 2008 (r183840) @@ -0,0 +1,162 @@ +/*- + * Copyright (C) 2008 MARVELL INTERNATIONAL LTD. + * All rights reserved. + * + * Developed by Semihalf. + * + * 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. + * 3. Neither the name of MARVELL nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY 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 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 + +/* + * Bus space functions for Marvell SoC family + */ + +/* Prototypes for all the bus_space structure functions */ +bs_protos(generic); +bs_protos(generic_armv4); + +/* + * The obio bus space tag. This is constant for all instances, so + * we never have to explicitly "create" it. + */ +static struct bus_space _base_tag = { + /* cookie */ + (void *) 0, + + /* mapping/unmapping */ + generic_bs_map, + generic_bs_unmap, + generic_bs_subregion, + + /* allocation/deallocation */ + generic_bs_alloc, + generic_bs_free, + + /* barrier */ + generic_bs_barrier, + + /* read (single) */ + generic_bs_r_1, + generic_armv4_bs_r_2, + generic_bs_r_4, + NULL, + + /* read multiple */ + generic_bs_rm_1, + generic_armv4_bs_rm_2, + generic_bs_rm_4, + NULL, + + /* read region */ + generic_bs_rr_1, + generic_armv4_bs_rr_2, + generic_bs_rr_4, + NULL, + + /* write (single) */ + generic_bs_w_1, + generic_armv4_bs_w_2, + generic_bs_w_4, + NULL, + + /* write multiple */ + generic_bs_wm_1, + generic_armv4_bs_wm_2, + generic_bs_wm_4, + NULL, + + /* write region */ + NULL, + NULL, + NULL, + NULL, + + /* set multiple */ + NULL, + NULL, + NULL, + NULL, + + /* set region */ + NULL, + NULL, + NULL, + NULL, + + /* copy */ + NULL, + NULL, + NULL, + NULL, + + /* read stream (single) */ + NULL, + NULL, + NULL, + NULL, + + /* read multiple stream */ + NULL, + generic_armv4_bs_rm_2, /* bus_space_read_multi_stream_2 */ + NULL, + NULL, + + /* read region stream */ + NULL, + NULL, + NULL, + NULL, + + /* write stream (single) */ + NULL, + NULL, + NULL, + NULL, + + /* write multiple stream */ + NULL, + generic_armv4_bs_wm_2, /* bus_space_write_multi_stream_2 */ + NULL, + NULL, + + /* write region stream */ + NULL, + NULL, + NULL, + NULL +}; + +bus_space_tag_t obio_tag = &_base_tag; Added: head/sys/arm/mv/common.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/mv/common.c Mon Oct 13 20:07:13 2008 (r183840) @@ -0,0 +1,965 @@ +/*- + * Copyright (C) 2008 MARVELL INTERNATIONAL LTD. + * All rights reserved. + * + * Developed by Semihalf. + * + * 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. + * 3. Neither the name of MARVELL nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY 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 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 + +static int win_eth_can_remap(int i); + +static int decode_win_cpu_valid(void); +static int decode_win_usb_valid(void); +static int decode_win_eth_valid(void); +static int decode_win_pcie_valid(void); + +static void decode_win_cpu_setup(void); +static void decode_win_usb_setup(uint32_t ctrl); +static void decode_win_eth_setup(uint32_t base); +static void decode_win_pcie_setup(uint32_t base); + +static uint32_t dev, rev; + +uint32_t +read_cpu_ctrl(uint32_t reg) +{ + + return (bus_space_read_4(obio_tag, MV_CPU_CONTROL_BASE, reg)); +} + +void +write_cpu_ctrl(uint32_t reg, uint32_t val) +{ + + bus_space_write_4(obio_tag, MV_CPU_CONTROL_BASE, reg, val); +} + +void +cpu_reset(void) +{ + + write_cpu_ctrl(RSTOUTn_MASK, SOFT_RST_OUT_EN); + write_cpu_ctrl(SYSTEM_SOFT_RESET, SYS_SOFT_RST); + while (1); +} + +uint32_t +cpu_extra_feat(void) +{ + uint32_t ef = 0; + + soc_id(&dev, &rev); + if (dev == MV_DEV_88F6281 || dev == MV_DEV_MV78100) + __asm __volatile("mrc p15, 1, %0, c15, c1, 0" : "=r" (ef)); + else if (dev == MV_DEV_88F5182 || dev == MV_DEV_88F5281) + __asm __volatile("mrc p15, 0, %0, c14, c0, 0" : "=r" (ef)); + else if (bootverbose) + printf("This ARM Core does not support any extra features\n"); + + return (ef); +} + +uint32_t +soc_power_ctrl_get(uint32_t mask) +{ + + if (mask != CPU_PM_CTRL_NONE) + mask &= read_cpu_ctrl(CPU_PM_CTRL); + + return (mask); +} + +uint32_t +get_tclk(void) +{ + +#if defined(SOC_MV_DISCOVERY) + return (TCLK_200MHZ); +#else + return (TCLK_166MHZ); +#endif +} + +void +soc_id(uint32_t *dev, uint32_t *rev) +{ + + /* + * Notice: system identifiers are available in the registers range of + * PCIE controller, so using this function is only allowed (and + * possible) after the internal registers range has been mapped in via + * pmap_devmap_bootstrap(). + */ + *dev = bus_space_read_4(obio_tag, MV_PCIE_BASE, 0) >> 16; + *rev = bus_space_read_4(obio_tag, MV_PCIE_BASE, 8) & 0xff; +} + +void +soc_identify(void) +{ + uint32_t d, r; + const char *dev; + const char *rev; + + soc_id(&d, &r); + + printf("SOC: "); + if (bootverbose) + printf("(0x%4x:0x%02x) ", d, r); + + rev = ""; + switch (d) { + case MV_DEV_88F5181: + dev = "Marvell 88F5181"; + if (r == 3) + rev = "B1"; + break; + case MV_DEV_88F5182: + dev = "Marvell 88F5182"; + if (r == 2) + rev = "A2"; + break; + case MV_DEV_88F5281: + dev = "Marvell 88F5281"; + if (r == 4) + rev = "D0"; + else if (r == 5) + rev = "D1"; + else if (r == 6) + rev = "D2"; + break; + case MV_DEV_88F6281: + dev = "Marvell 88F6281"; + break; + case MV_DEV_MV78100: + dev = "Marvell MV78100"; + break; + default: + dev = "UNKNOWN"; + break; + } + + printf("%s", dev); + if (*rev != '\0') + printf(" rev %s", rev); + printf(", TClock %dMHz\n", get_tclk() / 1000 / 1000); + + /* TODO add info on currently set endianess */ +} + +int +soc_decode_win(void) +{ + + /* Retrieve our ID: some windows facilities vary between SoC models */ + soc_id(&dev, &rev); + + if (decode_win_cpu_valid() != 1 || decode_win_usb_valid() != 1 || + decode_win_eth_valid() != 1 || decode_win_idma_valid() != 1 || + decode_win_pcie_valid() != 1) + return(-1); + + decode_win_cpu_setup(); + decode_win_usb_setup(MV_USB0_BASE); + decode_win_eth_setup(MV_ETH0_BASE); + if (dev == MV_DEV_MV78100) + decode_win_eth_setup(MV_ETH1_BASE); + decode_win_idma_setup(); + decode_win_pcie_setup(MV_PCIE_BASE); + + /* TODO set up decode wins for SATA */ + + return (0); +} + +/************************************************************************** + * Decode windows registers accessors + **************************************************************************/ +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) +WIN_REG_IDX_RD(win_cpu, remap_h, MV_WIN_CPU_REMAP_HI, MV_MBUS_BRIDGE_BASE) +WIN_REG_IDX_WR(win_cpu, cr, MV_WIN_CPU_CTRL, MV_MBUS_BRIDGE_BASE) +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) + +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_IDX_RD(win_usb, cr, MV_WIN_USB_CTRL, MV_USB_AWR_BASE) +WIN_REG_IDX_RD(win_usb, br, MV_WIN_USB_BASE, MV_USB_AWR_BASE) +WIN_REG_IDX_WR(win_usb, cr, MV_WIN_USB_CTRL, MV_USB_AWR_BASE) +WIN_REG_IDX_WR(win_usb, br, MV_WIN_USB_BASE, MV_USB_AWR_BASE) + +WIN_REG_BASE_IDX_RD(win_eth, br, MV_WIN_ETH_BASE) +WIN_REG_BASE_IDX_RD(win_eth, sz, MV_WIN_ETH_SIZE) +WIN_REG_BASE_IDX_RD(win_eth, har, MV_WIN_ETH_REMAP) +WIN_REG_BASE_IDX_WR(win_eth, br, MV_WIN_ETH_BASE) +WIN_REG_BASE_IDX_WR(win_eth, sz, MV_WIN_ETH_SIZE) +WIN_REG_BASE_IDX_WR(win_eth, har, MV_WIN_ETH_REMAP) +WIN_REG_BASE_RD(win_eth, bare, 0x290) +WIN_REG_BASE_RD(win_eth, epap, 0x294) +WIN_REG_BASE_WR(win_eth, bare, 0x290) +WIN_REG_BASE_WR(win_eth, epap, 0x294) + +WIN_REG_BASE_IDX_RD(win_pcie, cr, MV_WIN_PCIE_CTRL); +WIN_REG_BASE_IDX_RD(win_pcie, br, MV_WIN_PCIE_BASE); +WIN_REG_BASE_IDX_RD(win_pcie, remap, MV_WIN_PCIE_REMAP); +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_WR(pcie, bar, MV_PCIE_BAR); + +WIN_REG_IDX_RD(win_idma, br, MV_WIN_IDMA_BASE, MV_IDMA_BASE) +WIN_REG_IDX_RD(win_idma, sz, MV_WIN_IDMA_SIZE, MV_IDMA_BASE) +WIN_REG_IDX_RD(win_idma, har, MV_WIN_IDMA_REMAP, MV_IDMA_BASE) +WIN_REG_IDX_RD(win_idma, cap, MV_WIN_IDMA_CAP, MV_IDMA_BASE) +WIN_REG_IDX_WR(win_idma, br, MV_WIN_IDMA_BASE, MV_IDMA_BASE) +WIN_REG_IDX_WR(win_idma, sz, MV_WIN_IDMA_SIZE, MV_IDMA_BASE) +WIN_REG_IDX_WR(win_idma, har, MV_WIN_IDMA_REMAP, MV_IDMA_BASE) +WIN_REG_IDX_WR(win_idma, cap, MV_WIN_IDMA_CAP, MV_IDMA_BASE) +WIN_REG_RD(win_idma, bare, 0xa80, MV_IDMA_BASE) +WIN_REG_WR(win_idma, bare, 0xa80, MV_IDMA_BASE) + +/************************************************************************** + * Decode windows helper routines + **************************************************************************/ +void +soc_dump_decode_win(void) +{ + int i; + + soc_id(&dev, &rev); + + for (i = 0; i < MV_WIN_CPU_MAX; i++) { + printf("CPU window#%d: c 0x%08x, b 0x%08x", i, + win_cpu_cr_read(i), + win_cpu_br_read(i)); + + if (win_cpu_can_remap(i)) + printf(", rl 0x%08x, rh 0x%08x", + win_cpu_remap_l_read(i), + win_cpu_remap_h_read(i)); + + printf("\n"); + } + printf("Internal regs base: 0x%08x\n", + bus_space_read_4(obio_tag, MV_INTREGS_BASE, 0)); + + for (i = 0; i < MV_WIN_DDR_MAX; i++) + printf("DDR CS#%d: b 0x%08x, s 0x%08x\n", i, + ddr_br_read(i), ddr_sz_read(i)); + + for (i = 0; i < MV_WIN_USB_MAX; i++) + printf("USB window#%d: c 0x%08x, b 0x%08x\n", i, + win_usb_cr_read(i), win_usb_br_read(i)); + + for (i = 0; i < MV_WIN_ETH_MAX; i++) { + printf("ETH window#%d: b 0x%08x, s 0x%08x", i, + win_eth_br_read(MV_ETH0_BASE, i), + win_eth_sz_read(MV_ETH0_BASE, i)); + + if (win_eth_can_remap(i)) + printf(", ha 0x%08x", + win_eth_har_read(MV_ETH0_BASE, i)); + + printf("\n"); + } + printf("ETH windows: bare 0x%08x, epap 0x%08x\n", + win_eth_bare_read(MV_ETH0_BASE), + win_eth_epap_read(MV_ETH0_BASE)); + + decode_win_idma_dump(); + printf("\n"); +} + +/************************************************************************** + * CPU windows routines + **************************************************************************/ +int +win_cpu_can_remap(int i) +{ + + /* Depending on the SoC certain windows have remap capability */ + if ((dev == MV_DEV_88F5182 && i < 2) || + (dev == MV_DEV_88F5281 && i < 4) || + (dev == MV_DEV_88F6281 && i < 4) || + (dev == MV_DEV_MV78100 && i < 8)) + return (1); + + return (0); +} + +/* XXX This should check for overlapping remap fields too.. */ +int +decode_win_overlap(int win, int win_no, const struct decode_win *wintab) +{ + const struct decode_win *tab; + int i; + + tab = wintab; + + for (i = 0; i < win_no; i++, tab++) { + if (i == win) + /* Skip self */ + continue; + + if ((tab->base + tab->size - 1) < (wintab + win)->base) + continue; + + else if (((wintab + win)->base + (wintab + win)->size - 1) < + tab->base) + continue; + else + return (i); + } + + return (-1); +} + +static int +decode_win_cpu_valid(void) +{ + int i, j, rv; + uint32_t b, e, s; + + if (cpu_wins_no > MV_WIN_CPU_MAX) { + printf("CPU windows: too many entries: %d\n", cpu_wins_no); + return (-1); + } + + rv = 1; + for (i = 0; i < cpu_wins_no; i++) { + + if (cpu_wins[i].target == 0) { + printf("CPU window#%d: DDR target window is not " + "supposed to be reprogrammed!\n", i); + rv = 0; + } + + 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; + } + + s = cpu_wins[i].size; + b = cpu_wins[i].base; + e = b + s - 1; + if (s > (0xFFFFFFFF - b + 1)) { + /* + * XXX this boundary check should account for 64bit + * and remapping.. + */ + printf("CPU window#%d: no space for size 0x%08x at " + "0x%08x\n", i, s, b); + 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 " + "with #%d (0x%08x - 0x%08x)\n", i, b, e, j, + cpu_wins[j].base, + cpu_wins[j].base + cpu_wins[j].size - 1); + rv = 0; + } + } + + return (rv); +} + +static void +decode_win_cpu_setup(void) +{ + uint32_t br, cr; + int i; + + /* Disable all CPU windows */ + for (i = 0; i < MV_WIN_CPU_MAX; i++) { + win_cpu_cr_write(i, 0); + win_cpu_br_write(i, 0); + if (win_cpu_can_remap(i)) { + win_cpu_remap_l_write(i, 0); + win_cpu_remap_h_write(i, 0); + } + } + + for (i = 0; i < cpu_wins_no; i++) + if (cpu_wins[i].target > 0) { + + br = cpu_wins[i].base & 0xffff0000; + win_cpu_br_write(i, br); + + if (win_cpu_can_remap(i)) { + if (cpu_wins[i].remap >= 0) { + win_cpu_remap_l_write(i, + cpu_wins[i].remap & 0xffff0000); + win_cpu_remap_h_write(i, 0); + } else { + /* + * Remap function is not used for + * a given window (capable of + * remapping) - set remap field with the + * same value as base. + */ + win_cpu_remap_l_write(i, + cpu_wins[i].base & 0xffff0000); + win_cpu_remap_h_write(i, 0); + } + } + + cr = ((cpu_wins[i].size - 1) & 0xffff0000) | + (cpu_wins[i].attr << 8) | + (cpu_wins[i].target << 4) | 1; + + win_cpu_cr_write(i, cr); + } +} + +/* + * Check if we're able to cover all active DDR banks. + */ +static int +decode_win_can_cover_ddr(int max) +{ + int i, c; + + c = 0; + for (i = 0; i < MV_WIN_DDR_MAX; i++) + if (ddr_is_active(i)) + c++; + + if (c > max) { + printf("Unable to cover all active DDR banks: " + "%d, available windows: %d\n", c, max); + return (0); + } + + return (1); +} + +/************************************************************************** + * DDR windows routines + **************************************************************************/ +int +ddr_is_active(int i) +{ + + if (ddr_sz_read(i) & 0x1) + return (1); + + return (0); +} + +uint32_t +ddr_base(int i) +{ + + return (ddr_br_read(i) & 0xff000000); +} + +uint32_t +ddr_size(int i) +{ + + return ((ddr_sz_read(i) | 0x00ffffff) + 1); +} + +uint32_t +ddr_attr(int i) +{ + + return (i == 0 ? 0xe : + (i == 1 ? 0xd : + (i == 2 ? 0xb : + (i == 3 ? 0x7 : 0xff)))); +} + +uint32_t +ddr_target(int i) +{ + + /* Mbus unit ID is 0x0 for DDR SDRAM controller */ + return (0); +} + +/************************************************************************** + * USB windows routines + **************************************************************************/ +static int +decode_win_usb_valid(void) +{ + + return (decode_win_can_cover_ddr(MV_WIN_USB_MAX)); +} + +/* + * Set USB decode windows. + */ +static void +decode_win_usb_setup(uint32_t ctrl) +{ + uint32_t br, cr; + int i, j; + + /* Disable and clear all USB windows */ + for (i = 0; i < MV_WIN_USB_MAX; i++) { + win_usb_cr_write(i, 0); + win_usb_br_write(i, 0); + } + + /* Only access to active DRAM banks is required */ + for (i = 0; i < MV_WIN_DDR_MAX; i++) + if (ddr_is_active(i)) { + br = ddr_base(i); + /* + * XXX for 6281 we should handle Mbus write burst limit + * field in the ctrl reg + */ + cr = (((ddr_size(i) - 1) & 0xffff0000) | + (ddr_attr(i) << 8) | (ddr_target(i) << 4) | 1); + + /* Set the first free USB window */ + for (j = 0; j < MV_WIN_USB_MAX; j++) { + if (win_usb_cr_read(j) & 0x1) + continue; + + win_usb_br_write(j, br); + win_usb_cr_write(j, cr); + break; + } + } +} + +/************************************************************************** + * ETH windows routines + **************************************************************************/ + +static int +win_eth_can_remap(int i) +{ + + /* ETH encode windows 0-3 have remap capability */ + if (i < 4) + return (1); + + return (0); +} + +static int +eth_bare_read(uint32_t base, int i) +{ + uint32_t v; + + v = win_eth_bare_read(base); + v &= (1 << i); + + return (v >> i); +} + +static void +eth_bare_write(uint32_t base, int i, int val) +{ + uint32_t v; + + v = win_eth_bare_read(base); + v &= ~(1 << i); + v |= (val << i); + win_eth_bare_write(base, v); +} + +static void +eth_epap_write(uint32_t base, int i, int val) +{ + uint32_t v; + + v = win_eth_epap_read(base); + v &= ~(0x3 << (i * 2)); + v |= (val << (i * 2)); + win_eth_epap_write(base, v); +} + +static void +decode_win_eth_setup(uint32_t base) +{ + uint32_t br, sz; + int i, j; + + /* Disable, clear and revoke protection for all ETH windows */ + for (i = 0; i < MV_WIN_ETH_MAX; i++) { + + eth_bare_write(base, i, 1); + eth_epap_write(base, i, 0); + win_eth_br_write(base, i, 0); + win_eth_sz_write(base, i, 0); + if (win_eth_can_remap(i)) + win_eth_har_write(base, i, 0); + } + + /* Only access to active DRAM banks is required */ + for (i = 0; i < MV_WIN_DDR_MAX; i++) + if (ddr_is_active(i)) { + + br = ddr_base(i) | (ddr_attr(i) << 8) | ddr_target(i); + sz = ((ddr_size(i) - 1) & 0xffff0000); + + /* Set the first free ETH window */ + for (j = 0; j < MV_WIN_ETH_MAX; j++) { + if (eth_bare_read(base, j) == 0) + continue; + + win_eth_br_write(base, j, br); + win_eth_sz_write(base, j, sz); + + /* XXX remapping ETH windows not supported */ + + /* Set protection RW */ + eth_epap_write(base, j, 0x3); + + /* Enable window */ + eth_bare_write(base, j, 0); + break; + } + } +} + +static int +decode_win_eth_valid(void) +{ + + return (decode_win_can_cover_ddr(MV_WIN_ETH_MAX)); +} + +/************************************************************************** + * PCIE windows routines + **************************************************************************/ + +static void +decode_win_pcie_setup(uint32_t base) +{ + uint32_t size = 0; + uint32_t cr, br; + int i, j; + + 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); + win_pcie_br_write(base, i, 0); + win_pcie_remap_write(base, i, 0); + } + + for (i = 0; i < MV_WIN_DDR_MAX; i++) { + if (ddr_is_active(i)) { + /* Map DDR to BAR 1 */ + cr = (ddr_size(i) - 1) & 0xffff0000; + size += ddr_size(i) & 0xffff0000; + cr |= (ddr_attr(i) << 8) | (ddr_target(i) << 4) | 1; + br = ddr_base(i); + + /* Use the first available PCIE window */ + for (j = 0; j < MV_WIN_PCIE_MAX; j++) { + if (win_pcie_cr_read(base, j) != 0) + continue; + + win_pcie_br_write(base, j, br); + win_pcie_cr_write(base, j, cr); + break; + } + } + } + + /* + * Upper 16 bits in BAR register is interpreted as BAR size + * (in 64 kB units) plus 64kB, so substract 0x10000 + * form value passed to register to get correct value. + */ + size -= 0x10000; + pcie_bar_write(base, 0, size | 1); +} + +static int +decode_win_pcie_valid(void) +{ + + return (decode_win_can_cover_ddr(MV_WIN_PCIE_MAX)); +} + +/************************************************************************** + * IDMA windows routines + **************************************************************************/ +#if defined(SOC_MV_ORION) || defined(SOC_MV_DISCOVERY) +static int +idma_bare_read(int i) +{ + uint32_t v; + + v = win_idma_bare_read(); + v &= (1 << i); + + return (v >> i); +} + +static void +idma_bare_write(int i, int val) +{ + uint32_t v; + + v = win_idma_bare_read(); + v &= ~(1 << i); + v |= (val << i); + win_idma_bare_write(v); +} + +/* + * Sets channel protection 'val' for window 'w' on channel 'c' + */ +static void +idma_cap_write(int c, int w, int val) +{ + uint32_t v; + + v = win_idma_cap_read(c); + v &= ~(0x3 << (w * 2)); + v |= (val << (w * 2)); + win_idma_cap_write(c, v); +} + +/* + * Set protection 'val' on all channels for window 'w' + */ +static void +idma_set_prot(int w, int val) +{ + int c; + + for (c = 0; c < MV_IDMA_CHAN_MAX; c++) + idma_cap_write(c, w, val); +} + +static int +win_idma_can_remap(int i) +{ + + /* IDMA decode windows 0-3 have remap capability */ + if (i < 4) + return (1); + + return (0); +} + +void +decode_win_idma_setup(void) +{ + uint32_t br, sz; + int i, j; + + /* + * Disable and clear all IDMA windows, revoke protection for all channels + */ + for (i = 0; i < MV_WIN_IDMA_MAX; i++) { + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Mon Oct 13 20:24:04 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 32FA2106569B; Mon, 13 Oct 2008 20:24:04 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 20DE48FC20; Mon, 13 Oct 2008 20:24:04 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9DKO4jh085448; Mon, 13 Oct 2008 20:24:04 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9DKO4eO085447; Mon, 13 Oct 2008 20:24:04 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200810132024.m9DKO4eO085447@svn.freebsd.org> From: Warner Losh Date: Mon, 13 Oct 2008 20:24:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183841 - head/libexec/rtld-elf/mips X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Oct 2008 20:24:04 -0000 Author: imp Date: Mon Oct 13 20:24:03 2008 New Revision: 183841 URL: http://svn.freebsd.org/changeset/base/183841 Log: This code has no copyright. It is fairly obvious to me that we're a derivitive of NetBSD's mips_reloc.c, so pull in the copyright notice from there. Also, a minor tweak to load/store pointers. Other changes from NetBSD likely would be useful too... Obtained from: NetBSD Modified: head/libexec/rtld-elf/mips/reloc.c Modified: head/libexec/rtld-elf/mips/reloc.c ============================================================================== --- head/libexec/rtld-elf/mips/reloc.c Mon Oct 13 20:07:13 2008 (r183840) +++ head/libexec/rtld-elf/mips/reloc.c Mon Oct 13 20:24:03 2008 (r183841) @@ -1,4 +1,33 @@ /* $NetBSD: mdreloc.c,v 1.23 2003/07/26 15:04:38 mrg Exp $ */ +/* $NetBSD: mips_reloc.c,v 1.53 2008/07/24 04:39:25 matt Exp $ */ + +/* + * Copyright 1997 Michael L. Hitch + * Portions copyright 2002 Charles M. Hannum + * 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. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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$"); @@ -35,21 +64,33 @@ void _rtld_relocate_nonplt_self(Elf_Dyn int open(); int _open(); +/* + * It is possible for the compiler to emit relocations for unaligned data. + * We handle this situation with these inlines. + */ +#define RELOC_ALIGNED_P(x) \ + (((uintptr_t)(x) & (sizeof(void *) - 1)) == 0) + static __inline Elf_Addr load_ptr(void *where) { - Elf_Addr res; - - memcpy(&res, where, sizeof(res)); + if (__predict_true(RELOC_ALIGNED_P(where))) + return *(Elf_Addr *)where; + else { + Elf_Addr res; - return (res); + (void)memcpy(&res, where, sizeof(res)); + return res; + } } -void +static __inline void store_ptr(void *where, Elf_Addr val) { - - memcpy(where, &val, sizeof(val)); + if (__predict_true(RELOC_ALIGNED_P(where))) + *(Elf_Addr *)where = val; + else + (void)memcpy(where, &val, sizeof(val)); } void @@ -149,13 +190,6 @@ _mips_rtld_bind(Obj_Entry *obj, Elf_Size } /* - * It is possible for the compiler to emit relocations for unaligned data. - * We handle this situation with these inlines. - */ -#define RELOC_ALIGNED_P(x) \ - (((uintptr_t)(x) & (sizeof(void *) - 1)) == 0) - -/* * Process non-PLT relocations */ int From owner-svn-src-head@FreeBSD.ORG Mon Oct 13 20:38:33 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 79C7D106569C; Mon, 13 Oct 2008 20:38:33 +0000 (UTC) (envelope-from n_hibma@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 67D088FC18; Mon, 13 Oct 2008 20:38:33 +0000 (UTC) (envelope-from n_hibma@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9DKcXqt085749; Mon, 13 Oct 2008 20:38:33 GMT (envelope-from n_hibma@svn.freebsd.org) Received: (from n_hibma@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9DKcXT2085748; Mon, 13 Oct 2008 20:38:33 GMT (envelope-from n_hibma@svn.freebsd.org) Message-Id: <200810132038.m9DKcXT2085748@svn.freebsd.org> From: Nick Hibma Date: Mon, 13 Oct 2008 20:38:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183842 - head/sys/dev/usb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Oct 2008 20:38:33 -0000 Author: n_hibma Date: Mon Oct 13 20:38:33 2008 New Revision: 183842 URL: http://svn.freebsd.org/changeset/base/183842 Log: - Only refuse to attach to the first interface on the Huawei cards as for example the Huawei Mobile has an SD card slot on the second interface. - Do not attach to Qualcomm and Novatel cards. If ignored these cards will switch to modem mode automatically it seems. - Reduce the priority on generic attachment to the appropriate level. Note: A better solution is to send an eject command straightaway, but that can be left till later. Modified: head/sys/dev/usb/umass.c Modified: head/sys/dev/usb/umass.c ============================================================================== --- head/sys/dev/usb/umass.c Mon Oct 13 20:24:03 2008 (r183841) +++ head/sys/dev/usb/umass.c Mon Oct 13 20:38:33 2008 (r183842) @@ -1177,12 +1177,28 @@ umass_match_proto(struct umass_softc *sc dd = usbd_get_device_descriptor(udev); - /* - * These are radio devices with auto-install flash disks for win/mac. - * We want the ubsa driver to kick them into shape instead. - */ - if (UGETW(dd->idVendor) == USB_VENDOR_HUAWEI) - return(UMATCH_NONE); + /* These are 3G modes (E220, Mobile, etc.) devices with auto-install + * flash disks for Windows/MacOSX through the first interface. + * We are assuming that these vendors will not produce mass storage + * devices. See the list of supported parts in u3g, if this happens to + * be a mistake in the future. + */ + if (UGETW(dd->idVendor) == USB_VENDOR_HUAWEI) { + /* The interface is reset in the u3g driver + * (u3g_huawei_reinit()). Allow generic attachment to the + * second interface though. Some Huawei devices contain an SD + * card slot. + */ + id = usbd_get_interface_descriptor(iface); + if (id == NULL || id->bInterfaceNumber == 0) + return UMATCH_NONE; + } else if (UGETW(dd->idVendor) == USB_VENDOR_QUALCOMMINC + || UGETW(dd->idVendor) == USB_VENDOR_NOVATEL) { + /* Device by these vendors will automatically reappear as a + * ucom device if ignored (or if sent an eject command). + */ + return UMATCH_NONE; + } /* An entry specifically for Y-E Data devices as they don't fit in the * device description table. @@ -1279,7 +1295,7 @@ umass_match_proto(struct umass_softc *sc return(UMATCH_NONE); } - return(UMATCH_DEVCLASS_DEVSUBCLASS_DEVPROTO); + return(UMATCH_IFACECLASS_IFACESUBCLASS_IFACEPROTO); } static int @@ -1291,6 +1307,7 @@ umass_match(device_t self) sc->sc_dev = self; if (uaa->iface == NULL) return(UMATCH_NONE); + return(umass_match_proto(sc, uaa->iface, uaa->device)); } From owner-svn-src-head@FreeBSD.ORG Mon Oct 13 20:41:11 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7C52A106568C; Mon, 13 Oct 2008 20:41:11 +0000 (UTC) (envelope-from n_hibma@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 693CC8FC1A; Mon, 13 Oct 2008 20:41:11 +0000 (UTC) (envelope-from n_hibma@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9DKfBC6085827; Mon, 13 Oct 2008 20:41:11 GMT (envelope-from n_hibma@svn.freebsd.org) Received: (from n_hibma@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9DKfBVx085825; Mon, 13 Oct 2008 20:41:11 GMT (envelope-from n_hibma@svn.freebsd.org) Message-Id: <200810132041.m9DKfBVx085825@svn.freebsd.org> From: Nick Hibma Date: Mon, 13 Oct 2008 20:41:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183843 - head/sys/dev/usb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Oct 2008 20:41:11 -0000 Author: n_hibma Date: Mon Oct 13 20:41:11 2008 New Revision: 183843 URL: http://svn.freebsd.org/changeset/base/183843 Log: - Add better support for Huawei cards, by attaching as an interface driver. - Be bold and add Novatel cards to the list of supported devices. One person reported success with the Novatal U950D. Modified: head/sys/dev/usb/u3g.c head/sys/dev/usb/ubsa.c Modified: head/sys/dev/usb/u3g.c ============================================================================== --- head/sys/dev/usb/u3g.c Mon Oct 13 20:38:33 2008 (r183842) +++ head/sys/dev/usb/u3g.c Mon Oct 13 20:41:11 2008 (r183843) @@ -1,8 +1,8 @@ /* * Copyright (c) 2008 AnyWi Technologies - * Author: Andrea Guzzo - * * based on uark.c 1.1 2006/08/14 08:30:22 jsg * - * * parts from ubsa.c 183348 2008-09-25 12:00:56Z phk * + * Author: Andrea Guzzo + * * based on uark.c 1.1 2006/08/14 08:30:22 jsg * + * * parts from ubsa.c 183348 2008-09-25 12:00:56Z phk * * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -41,31 +41,33 @@ #include "usbdevs.h" #ifdef U3G_DEBUG -#define DPRINTFN(n, x) do { if (u3gdebug > (n)) printf x; } while (0) -int u3gtebug = 0; +#define DPRINTFN(n, x) do { if (u3gdebug > (n)) printf x; } while (0) +int u3gtebug = 0; #else #define DPRINTFN(n, x) #endif #define DPRINTF(x) DPRINTFN(0, x) -#define U3GBUFSZ 1024 -#define U3G_MAXPORTS 4 +#define U3G_BUFSIZ 1024 +#define U3G_MAXPORTS 4 +#define U3G_CONFIG_INDEX 0 struct u3g_softc { - struct ucom_softc sc_ucom[U3G_MAXPORTS];; - device_t sc_dev; - usbd_device_handle sc_udev; - u_char sc_msr; - u_char sc_lsr; - u_char numports; + struct ucom_softc sc_ucom[U3G_MAXPORTS];; + device_t sc_dev; + usbd_device_handle sc_udev; + u_int16_t sc_flags; + u_char sc_msr; + u_char sc_lsr; + u_char numports; - usbd_interface_handle sc_intr_iface; /* interrupt interface */ + usbd_interface_handle sc_intr_iface; /* interrupt interface */ #ifdef U3G_DEBUG - int sc_intr_number; /* interrupt number */ - usbd_pipe_handle sc_intr_pipe; /* interrupt pipe */ - u_char *sc_intr_buf; /* interrupt buffer */ + int sc_intr_number; /* interrupt number */ + usbd_pipe_handle sc_intr_pipe; /* interrupt pipe */ + u_char *sc_intr_buf; /* interrupt buffer */ #endif - int sc_isize; + int sc_isize; }; struct ucom_callback u3g_callback = { @@ -79,49 +81,79 @@ struct ucom_callback u3g_callback = { NULL, }; -static const struct usb_devno u3g_devs[] = { + +/* + * Various supported device vendors/products. + */ +struct u3g_dev_type_s { + struct usb_devno u3g_dev; + u_int16_t u3g_flags; +#define U3GFL_NONE 0x0000 +#define U3GFL_HUAWEI_INIT 0x0001 /* Send USB command to reset iface to ucom mode */ +#define U3GFL_EJECT 0x0002 /* Send SCSI eject to reset first iface to ucom mode */ +}; + +static const struct u3g_dev_type_s u3g_devs[] = { /* OEM: Option */ - { USB_VENDOR_OPTION, USB_PRODUCT_OPTION_GT3G }, - { USB_VENDOR_OPTION, USB_PRODUCT_OPTION_GT3GQUAD }, - { USB_VENDOR_OPTION, USB_PRODUCT_OPTION_GT3GPLUS }, - { USB_VENDOR_OPTION, USB_PRODUCT_OPTION_GTMAX36 }, - { USB_VENDOR_OPTION, USB_PRODUCT_OPTION_VODAFONEMC3G }, + {{ USB_VENDOR_OPTION, USB_PRODUCT_OPTION_GT3G }, U3GFL_NONE}, + {{ USB_VENDOR_OPTION, USB_PRODUCT_OPTION_GT3GQUAD }, U3GFL_NONE}, + {{ USB_VENDOR_OPTION, USB_PRODUCT_OPTION_GT3GPLUS }, U3GFL_NONE}, + {{ USB_VENDOR_OPTION, USB_PRODUCT_OPTION_GTMAX36 }, U3GFL_NONE}, + {{ USB_VENDOR_OPTION, USB_PRODUCT_OPTION_VODAFONEMC3G }, U3GFL_NONE}, + /* OEM: Qualcomm, Inc. */ + {{ USB_VENDOR_QUALCOMMINC, USB_PRODUCT_QUALCOMMINC_CDMA_MSM }, U3GFL_EJECT}, /* OEM: Huawei */ - { USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_MOBILE }, - { USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_E220 }, - /* OEM: Qualcomm */ - { USB_VENDOR_QUALCOMMINC, USB_PRODUCT_QUALCOMMINC_CDMA_MSM }, - - { 0, 0 } + {{ USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_MOBILE }, U3GFL_HUAWEI_INIT}, + {{ USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_E220 }, U3GFL_HUAWEI_INIT}, + /* OEM: Novatel */ + {{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_CDMA_MODEM }, U3GFL_NONE }, + {{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_ES620 }, U3GFL_NONE }, + {{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_U720 }, U3GFL_NONE }, + {{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_U727 }, U3GFL_NONE }, + {{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_U740 }, U3GFL_NONE }, + {{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_U740_2 }, U3GFL_NONE }, + {{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_U950D }, U3GFL_EJECT }, + {{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_V620 }, U3GFL_NONE }, + {{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_V640 }, U3GFL_NONE }, + {{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_V720 }, U3GFL_NONE }, + {{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_V740 }, U3GFL_NONE }, + {{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_X950D }, U3GFL_NONE }, + {{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_U870 }, U3GFL_NONE }, + {{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_XU870 }, U3GFL_NONE }, + {{ USB_VENDOR_DELL, USB_PRODUCT_DELL_U740 }, U3GFL_NONE }, }; +#define u3g_lookup(v, p) ((const struct u3g_dev_type_s *)usb_lookup(u3g_devs, v, p)) #ifdef U3G_DEBUG static void u3g_intr(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) { struct u3g_softc *sc = (struct u3g_softc *)priv; - device_printf(sc->sc_dev, "INTERRUPT CALLBACK\n"); + device_printf(sc->sc_dev, "Interrupt callback\n"); } #endif static int -u3g_huawei_reinit(usbd_device_handle dev) +u3g_huawei_reinit(usbd_device_handle dev, usbd_interface_handle iface) { /* The Huawei device presents itself as a umass device with Windows * drivers on it. After installation of the driver, it reinits into a * 3G serial device. */ usb_device_request_t req; - usb_config_descriptor_t *cdesc; + usb_interface_descriptor_t *idesc; - /* Get the config descriptor */ - cdesc = usbd_get_config_descriptor(dev); - if (cdesc == NULL) - return (UMATCH_NONE); + if (iface == NULL) + return UMATCH_NONE; + idesc = usbd_get_interface_descriptor(iface); + if (idesc == NULL) + return UMATCH_NONE; - /* One iface means umass mode, more than 1 (4 usually) means 3G mode */ - if (cdesc->bNumInterface > 1) - return (UMATCH_VENDOR_PRODUCT); + /* If the interface class is no longer mass storage it has changed + * appearance and we should attach it. + */ + if (idesc->bInterfaceClass == UICLASS_VENDOR) + return (UMATCH_VENDOR_PRODUCT_CONF_IFACE); req.bmRequestType = UT_WRITE_DEVICE; req.bRequest = UR_SET_FEATURE; @@ -139,15 +171,14 @@ u3g_match(device_t self) { struct usb_attach_arg *uaa = device_get_ivars(self); - if (uaa->iface != NULL) - return (UMATCH_NONE); - - if (uaa->vendor == USB_VENDOR_HUAWEI) - return u3g_huawei_reinit(uaa->device); + const struct u3g_dev_type_s *u3g_dev_type = u3g_lookup(uaa->vendor, uaa->product); + if (u3g_dev_type) { + if (u3g_dev_type->u3g_flags & U3GFL_HUAWEI_INIT) + return u3g_huawei_reinit(uaa->device, uaa->iface); + else + return UMATCH_VENDOR_PRODUCT; + } - if (usb_lookup(u3g_devs, uaa->vendor, uaa->product)) - return UMATCH_VENDOR_PRODUCT; - return UMATCH_NONE; } @@ -172,7 +203,7 @@ u3g_attach(device_t self) sc->sc_intr_pipe = NULL; #endif /* Move the device into the configured state. */ - error = usbd_set_config_index(dev, 1, 1); + error = usbd_set_config_index(dev, U3G_CONFIG_INDEX, 1); if (error) { device_printf(self, "failed to set configuration: %s\n", usbd_errstr(error)); @@ -210,14 +241,14 @@ u3g_attach(device_t self) ed = usbd_interface2endpoint_descriptor(iface, n); if (ed == NULL) { device_printf(ucom->sc_dev, - "could not read endpoint descriptor\n"); + "could not read endpoint descriptor\n"); goto bad; } - if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && - UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) + if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN + && UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) ucom->sc_bulkin_no = ed->bEndpointAddress; - else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT && - UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) + else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT + && UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) ucom->sc_bulkout_no = ed->bEndpointAddress; } if (ucom->sc_bulkin_no == -1 || ucom->sc_bulkout_no == -1) { @@ -225,9 +256,9 @@ u3g_attach(device_t self) goto bad; } ucom->sc_parent = sc; - ucom->sc_ibufsize = U3GBUFSZ; - ucom->sc_obufsize = U3GBUFSZ; - ucom->sc_ibufsizepad = U3GBUFSZ; + ucom->sc_ibufsize = U3G_BUFSIZ; + ucom->sc_obufsize = U3G_BUFSIZ; + ucom->sc_ibufsizepad = U3G_BUFSIZ; ucom->sc_opkthdrlen = 0; ucom->sc_callback = &u3g_callback; @@ -254,14 +285,14 @@ u3g_attach(device_t self) u3g_intr, 100); if (error) { - device_printf(self, - "cannot open interrupt pipe (addr %d)\n", - sc->sc_intr_number); - goto bad; + device_printf(self, + "cannot open interrupt pipe (addr %d)\n", + sc->sc_intr_number); + goto bad; } } #endif - device_printf(self, "configured %d serial ports (/dev/cuaU%d.X)", + device_printf(self, "configured %d serial ports (/dev/cuaU%d.X)\n", sc->numports, device_get_unit(self)); return 0; @@ -286,7 +317,7 @@ u3g_detach(device_t self) sc->sc_ucom[i].sc_dying = 1; rv = ucom_detach(&sc->sc_ucom[i]); if(rv != 0) { - device_printf(self, "Can't deallocat port %d", i); + device_printf(self, "Can't deallocat port %d\n", i); return rv; } } @@ -302,8 +333,8 @@ u3g_detach(device_t self) err = usbd_close_pipe(sc->sc_intr_pipe); if (err) device_printf(self, - "close interrupt pipe failed: %s\n", - usbd_errstr(err)); + "close interrupt pipe failed: %s\n", + usbd_errstr(err)); free(sc->sc_intr_buf, M_USBDEV); sc->sc_intr_pipe = NULL; } Modified: head/sys/dev/usb/ubsa.c ============================================================================== --- head/sys/dev/usb/ubsa.c Mon Oct 13 20:38:33 2008 (r183842) +++ head/sys/dev/usb/ubsa.c Mon Oct 13 20:41:11 2008 (r183843) @@ -228,34 +228,6 @@ static const struct ubsa_product { { USB_VENDOR_PERACOM, USB_PRODUCT_PERACOM_SERIAL1 }, /* Merlin */ { USB_VENDOR_MERLIN, USB_PRODUCT_MERLIN_V620 }, - /* Novatel */ - { USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_CDMA_MODEM }, - /* Novatel Wireless Merlin ES620 */ - { USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_ES620 }, - /* Novatel Wireless Merlin U720 */ - { USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_U720 }, - /* Novatel Wireless Merlin U727 */ - { USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_U727 }, - /* Novatel Wireless Merlin U740 */ - { USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_U740 }, - { USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_U740_2 }, - /* Dell version of the Novatel 740 */ - { USB_VENDOR_DELL, USB_PRODUCT_DELL_U740 }, - /* Novatel Wireless Merlin U950D */ - { USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_U950D }, - /* Novatel Wireless Merlin V620 */ - { USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_V620 }, - /* Novatel Wireless Merlin V640 */ - { USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_V640 }, - /* Novatel Wireless Merlin V720 */ - { USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_V720 }, - /* Novatel Wireless Merlin V740 */ - { USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_V740 }, - /* Novatel Wireless Merlin X950D */ - { USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_X950D }, - /* Novatel Wireless Merlin U870 */ - { USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_U870 }, - { USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_XU870 }, /* Sierra Wireless AirCard 580 */ { USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AIRCARD580 }, /* Sierra Wireless AirCard 595 */ From owner-svn-src-head@FreeBSD.ORG Mon Oct 13 20:43:08 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E62841065693; Mon, 13 Oct 2008 20:43:08 +0000 (UTC) (envelope-from n_hibma@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D444F8FC13; Mon, 13 Oct 2008 20:43:08 +0000 (UTC) (envelope-from n_hibma@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9DKh8Ru085899; Mon, 13 Oct 2008 20:43:08 GMT (envelope-from n_hibma@svn.freebsd.org) Received: (from n_hibma@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9DKh8VN085896; Mon, 13 Oct 2008 20:43:08 GMT (envelope-from n_hibma@svn.freebsd.org) Message-Id: <200810132043.m9DKh8VN085896@svn.freebsd.org> From: Nick Hibma Date: Mon, 13 Oct 2008 20:43:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183844 - head/share/man/man4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Oct 2008 20:43:09 -0000 Author: n_hibma Date: Mon Oct 13 20:43:08 2008 New Revision: 183844 URL: http://svn.freebsd.org/changeset/base/183844 Log: Update the man pages with the moved/added support for devices. The SD card slot of the Huawei mobile card is supported by the (generic) umass driver. Modified: head/share/man/man4/u3g.4 head/share/man/man4/ubsa.4 head/share/man/man4/umass.4 Modified: head/share/man/man4/u3g.4 ============================================================================== --- head/share/man/man4/u3g.4 Mon Oct 13 20:41:11 2008 (r183843) +++ head/share/man/man4/u3g.4 Mon Oct 13 20:43:08 2008 (r183844) @@ -66,10 +66,16 @@ Option Globetrotter 3G .It Vodafone Mobile Connect Card 3G .It +Qualcomm Inc. CDMA MSM +.It Huawei E220 (E270?) .It Huawei Mobile +.It +Novatal U950D .El +(See /sys/dev/u3g.c for the complete list of supported cards for each vendor +mentioned above). .Pp The supported 3G cards provide the necessary modem port for ppp, pppd, or mpd connections as well as extra ports (depending on the specific @@ -78,18 +84,13 @@ device) to provide other functions (diag .Xr tty 4 , .Xr ucom 4 , .Xr usb 4 , -.Xr ubsa 4 .Sh HISTORY The .Nm driver appeared in -.Fx 8.0 . -The -.Xr ubsa 4 -manual page was modified for -.Nm -by +.Fx 8.0 , +is based on the uark driver, and written by .An Andrea Guzzo Aq aguzzo@anywi.com in September 2008. .Sh AUTHORS Modified: head/share/man/man4/ubsa.4 ============================================================================== --- head/share/man/man4/ubsa.4 Mon Oct 13 20:41:11 2008 (r183843) +++ head/share/man/man4/ubsa.4 Mon Oct 13 20:43:08 2008 (r183844) @@ -85,28 +85,8 @@ e-Tek Labs Kwik232 .It GoHubs GoCOM232 .It -Huawei Technologies Mobile card (3G) -.It -Novatel Wireless Merlin U740 (only basic modem port supported) -.It -Option Globetrotter 3G (aka Vodafone Mobile Connect Card 3G) -.It -Option Globetrotter 3G Quad -.It -Option Globetrotter 3G Fusion (no WLAN support, only basic 3G modem port) -.It -Option Globetrotter 3G Fusion Quad (no WLAN support) -.It -Option Globetrotter Max 3.6 -.It Peracom single port serial adapter -.It -Qualcomm, Inc. ZTE CDMA Technologies MSM .El -.Pp -The supported 3G cards provide the necessary modem port for ppp, -pppd, or mpd connections; other functions of these cards (diagnostic port, -SIM toolkit port, WLAN) are not supported. .Sh SEE ALSO .Xr tty 4 , .Xr ucom 4 , Modified: head/share/man/man4/umass.4 ============================================================================== --- head/share/man/man4/umass.4 Mon Oct 13 20:41:11 2008 (r183843) +++ head/share/man/man4/umass.4 Mon Oct 13 20:43:08 2008 (r183844) @@ -85,6 +85,8 @@ FujiFilm Zip USB Drive ZDR100 USB A .It GREEN HOUSE USB Flash Memory "PicoDrive" GH-UFD32M, 64M, 128M .It +Huawei Mobile (SD slot) +.It IBM 32MB USB Memory Key (P/N 22P5296) .It IBM 256MB USB Drive (MSYSTEM DiskOnKey2) From owner-svn-src-head@FreeBSD.ORG Mon Oct 13 21:02:19 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 628601065686; Mon, 13 Oct 2008 21:02:19 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 505AD8FC1F; Mon, 13 Oct 2008 21:02:19 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9DL2J0j086308; Mon, 13 Oct 2008 21:02:19 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9DL2JlL086307; Mon, 13 Oct 2008 21:02:19 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <200810132102.m9DL2JlL086307@svn.freebsd.org> From: Christian Brueffer Date: Mon, 13 Oct 2008 21:02:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183845 - head/release/doc/en_US.ISO8859-1/hardware X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Oct 2008 21:02:19 -0000 Author: brueffer Date: Mon Oct 13 21:02:19 2008 New Revision: 183845 URL: http://svn.freebsd.org/changeset/base/183845 Log: Mention iwn(4) and malo(4). Note that the malo entry doesn't suck in the hardware adapter list from the manpage yet, as man2hwnotes.pl doesn't grok the table format. Modified: head/release/doc/en_US.ISO8859-1/hardware/article.sgml Modified: head/release/doc/en_US.ISO8859-1/hardware/article.sgml ============================================================================== --- head/release/doc/en_US.ISO8859-1/hardware/article.sgml Mon Oct 13 20:43:08 2008 (r183844) +++ head/release/doc/en_US.ISO8859-1/hardware/article.sgml Mon Oct 13 21:02:19 2008 (r183845) @@ -822,6 +822,13 @@ 2200BG/2915ABG MiniPCI and 2225BG PCI network adapters (&man.iwi.4; driver) + [&arch.i386;, &arch.amd64;] Intel Wireless WiFi Link + 4965AGN IEEE 802.11n PCI network adapters + (&man.iwn.4; driver) + + [&arch.i386;, &arch.amd64;] Marvell Libertas IEEE 802.11b/g + PCI network adapters (&man.malo.4; driver) + &hwlist.ral; [&arch.i386;, &arch.pc98;] Raytheon Raylink 2.4GHz From owner-svn-src-head@FreeBSD.ORG Mon Oct 13 21:04:52 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B1DA910656A0; Mon, 13 Oct 2008 21:04:52 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A032F8FC18; Mon, 13 Oct 2008 21:04:52 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9DL4qAU086382; Mon, 13 Oct 2008 21:04:52 GMT (envelope-from rdivacky@svn.freebsd.org) Received: (from rdivacky@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9DL4qxE086381; Mon, 13 Oct 2008 21:04:52 GMT (envelope-from rdivacky@svn.freebsd.org) Message-Id: <200810132104.m9DL4qxE086381@svn.freebsd.org> From: Roman Divacky Date: Mon, 13 Oct 2008 21:04:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183846 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Oct 2008 21:04:52 -0000 Author: rdivacky Date: Mon Oct 13 21:04:52 2008 New Revision: 183846 URL: http://svn.freebsd.org/changeset/base/183846 Log: Check the result of copyin and in a case of error return one. This prevents setting wrong priority or (more likely) returning EINVAL. Approved by: kib (mentor) Modified: head/sys/kern/kern_thr.c Modified: head/sys/kern/kern_thr.c ============================================================================== --- head/sys/kern/kern_thr.c Mon Oct 13 21:02:19 2008 (r183845) +++ head/sys/kern/kern_thr.c Mon Oct 13 21:04:52 2008 (r183846) @@ -126,6 +126,8 @@ kern_thr_new(struct thread *td, struct t rtpp = NULL; if (param->rtp != 0) { error = copyin(param->rtp, &rtp, sizeof(struct rtprio)); + if (error) + return (error); rtpp = &rtp; } error = create_thread(td, NULL, param->start_func, param->arg, From owner-svn-src-head@FreeBSD.ORG Mon Oct 13 22:50:38 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8E7E1106568B; Mon, 13 Oct 2008 22:50:38 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7C6F38FC08; Mon, 13 Oct 2008 22:50:38 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9DMoclW088817; Mon, 13 Oct 2008 22:50:38 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9DMocb1088816; Mon, 13 Oct 2008 22:50:38 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200810132250.m9DMocb1088816@svn.freebsd.org> From: Xin LI Date: Mon, 13 Oct 2008 22:50:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183857 - head/usr.bin/tftp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Oct 2008 22:50:38 -0000 Author: delphij Date: Mon Oct 13 22:50:38 2008 New Revision: 183857 URL: http://svn.freebsd.org/changeset/base/183857 Log: Use strlcpy() instead of strncpy() when we want the string to be NUL-terminated. Modified: head/usr.bin/tftp/main.c Modified: head/usr.bin/tftp/main.c ============================================================================== --- head/usr.bin/tftp/main.c Mon Oct 13 22:04:41 2008 (r183856) +++ head/usr.bin/tftp/main.c Mon Oct 13 22:50:38 2008 (r183857) @@ -233,11 +233,10 @@ setpeer0(host, port) /* res->ai_addr <= sizeof(peeraddr) is guaranteed */ memcpy(&peeraddr, res->ai_addr, res->ai_addrlen); if (res->ai_canonname) { - (void) strncpy(hostname, res->ai_canonname, + (void) strlcpy(hostname, res->ai_canonname, sizeof(hostname)); } else - (void) strncpy(hostname, host, sizeof(hostname)); - hostname[sizeof(hostname)-1] = 0; + (void) strlcpy(hostname, host, sizeof(hostname)); connected = 1; } From owner-svn-src-head@FreeBSD.ORG Mon Oct 13 23:10:19 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7EDE41065693; Mon, 13 Oct 2008 23:10:19 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6B6908FC1B; Mon, 13 Oct 2008 23:10:19 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9DNAJBF089208; Mon, 13 Oct 2008 23:10:19 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9DNAJeD089204; Mon, 13 Oct 2008 23:10:19 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200810132310.m9DNAJeD089204@svn.freebsd.org> From: Xin LI Date: Mon, 13 Oct 2008 23:10:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183858 - head/usr.bin/tftp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Oct 2008 23:10:19 -0000 Author: delphij Date: Mon Oct 13 23:10:19 2008 New Revision: 183858 URL: http://svn.freebsd.org/changeset/base/183858 Log: ANSIfy, plus constify interfaces where possible. Modified: head/usr.bin/tftp/extern.h head/usr.bin/tftp/main.c head/usr.bin/tftp/tftp.c head/usr.bin/tftp/tftpsubs.c Modified: head/usr.bin/tftp/extern.h ============================================================================== --- head/usr.bin/tftp/extern.h Mon Oct 13 22:50:38 2008 (r183857) +++ head/usr.bin/tftp/extern.h Mon Oct 13 23:10:19 2008 (r183858) @@ -34,5 +34,5 @@ * $FreeBSD$ */ -void recvfile(int, char *, char *); -void xmitfile(int, char *, char *); +void recvfile(int, const char *, const char *); +void xmitfile(int, const char *, const char *); Modified: head/usr.bin/tftp/main.c ============================================================================== --- head/usr.bin/tftp/main.c Mon Oct 13 22:50:38 2008 (r183857) +++ head/usr.bin/tftp/main.c Mon Oct 13 23:10:19 2008 (r183858) @@ -109,9 +109,9 @@ void status(int, char **); static void command(void) __dead2; static const char *command_prompt(void); -static void getusage(char *); +static void getusage(const char *); static void makeargv(void); -static void putusage(char *); +static void putusage(const char *); static void settftpmode(const char *); char *tail(char *); @@ -157,9 +157,7 @@ struct cmd cmdtab[] = { }; int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { f = -1; strcpy(mode, "netascii"); @@ -177,9 +175,7 @@ main(argc, argv) char hostname[MAXHOSTNAMELEN]; void -setpeer0(host, port) - char *host; - const char *port; +setpeer0(char *host, const char *port) { struct addrinfo hints, *res0, *res; int error; @@ -244,9 +240,7 @@ setpeer0(host, port) } void -setpeer(argc, argv) - int argc; - char *argv[]; +setpeer(int argc, char *argv[]) { if (argc < 2) { @@ -281,9 +275,7 @@ struct modes { }; void -modecmd(argc, argv) - int argc; - char *argv[]; +modecmd(int argc, char *argv[]) { struct modes *p; const char *sep; @@ -316,26 +308,21 @@ modecmd(argc, argv) } void -setbinary(argc, argv) - int argc __unused; - char *argv[] __unused; +setbinary(int argc __unused, char *argv[] __unused) { settftpmode("octet"); } void -setascii(argc, argv) - int argc __unused; - char *argv[] __unused; +setascii(int argc __unused, char *argv[] __unused) { settftpmode("netascii"); } static void -settftpmode(newmode) - const char *newmode; +settftpmode(const char *newmode) { strcpy(mode, newmode); if (verbose) @@ -347,9 +334,7 @@ settftpmode(newmode) * Send file(s). */ void -put(argc, argv) - int argc; - char *argv[]; +put(int argc, char *argv[]) { int fd; int n; @@ -421,8 +406,7 @@ put(argc, argv) } static void -putusage(s) - char *s; +putusage(const char *s) { printf("usage: %s file [[host:]remotename]\n", s); printf(" %s file1 file2 ... fileN [[host:]remote-directory]\n", s); @@ -432,9 +416,7 @@ putusage(s) * Receive file(s). */ void -get(argc, argv) - int argc; - char *argv[]; +get(int argc, char *argv[]) { int fd; int n; @@ -504,8 +486,7 @@ get(argc, argv) } static void -getusage(s) - char *s; +getusage(const char *s) { printf("usage: %s [host:]file [localname]\n", s); printf(" %s [host1:]file1 [host2:]file2 ... [hostN:]fileN\n", s); @@ -514,9 +495,7 @@ getusage(s) int rexmtval = TIMEOUT; void -setrexmt(argc, argv) - int argc; - char *argv[]; +setrexmt(int argc, char *argv[]) { int t; @@ -542,9 +521,7 @@ setrexmt(argc, argv) int maxtimeout = 5 * TIMEOUT; void -settimeout(argc, argv) - int argc; - char *argv[]; +settimeout(int argc, char *argv[]) { int t; @@ -568,9 +545,7 @@ settimeout(argc, argv) } void -status(argc, argv) - int argc __unused; - char *argv[] __unused; +status(int argc __unused, char *argv[] __unused) { if (connected) printf("Connected to %s.\n", hostname); @@ -583,8 +558,7 @@ status(argc, argv) } void -intr(dummy) - int dummy __unused; +intr(int dummy __unused) { signal(SIGALRM, SIG_IGN); @@ -593,8 +567,7 @@ intr(dummy) } char * -tail(filename) - char *filename; +tail(char *filename) { char *s; @@ -610,7 +583,7 @@ tail(filename) } static const char * -command_prompt() +command_prompt(void) { return ("tftp> "); @@ -620,7 +593,7 @@ command_prompt() * Command parser. */ static void -command() +command(void) { HistEvent he; struct cmd *c; @@ -679,8 +652,7 @@ command() } struct cmd * -getcmd(name) - char *name; +getcmd(char *name) { const char *p, *q; struct cmd *c, *found; @@ -711,7 +683,7 @@ getcmd(name) * Slice a string up into argc/argv. */ static void -makeargv() +makeargv(void) { char *cp; char **argp = margv; @@ -736,9 +708,7 @@ makeargv() } void -quit(argc, argv) - int argc __unused; - char *argv[] __unused; +quit(int argc __unused, char *argv[] __unused) { exit(txrx_error); } @@ -747,9 +717,7 @@ quit(argc, argv) * Help command. */ void -help(argc, argv) - int argc; - char *argv[]; +help(int argc, char *argv[]) { struct cmd *c; @@ -773,18 +741,14 @@ help(argc, argv) } void -settrace(argc, argv) - int argc __unused; - char **argv __unused; +settrace(int argc __unused, char **argv __unused) { trace = !trace; printf("Packet tracing %s.\n", trace ? "on" : "off"); } void -setverbose(argc, argv) - int argc __unused; - char **argv __unused; +setverbose(int argc __unused, char **argv __unused) { verbose = !verbose; printf("Verbose mode %s.\n", verbose ? "on" : "off"); Modified: head/usr.bin/tftp/tftp.c ============================================================================== --- head/usr.bin/tftp/tftp.c Mon Oct 13 22:50:38 2008 (r183857) +++ head/usr.bin/tftp/tftp.c Mon Oct 13 23:10:19 2008 (r183858) @@ -80,23 +80,20 @@ int timeout; jmp_buf toplevel; jmp_buf timeoutbuf; -static void nak(int, struct sockaddr *); +static void nak(int, const struct sockaddr *); static int makerequest(int, const char *, struct tftphdr *, const char *); static void printstats(const char *, unsigned long); static void startclock(void); static void stopclock(void); static void timer(int); static void tpacket(const char *, struct tftphdr *, int); -static int cmpport(struct sockaddr *, struct sockaddr *); +static int cmpport(const struct sockaddr *, const struct sockaddr *); /* * Send the requested file. */ void -xmitfile(fd, name, mode) - int fd; - char *name; - char *mode; +xmitfile(int fd, const char *name, const char *mode) { struct tftphdr *ap; /* data and ack packets */ struct tftphdr *dp; @@ -212,10 +209,7 @@ abort: * Receive a file. */ void -recvfile(fd, name, mode) - int fd; - char *name; - char *mode; +recvfile(int fd, const char *name, const char *mode) { struct tftphdr *ap; struct tftphdr *dp; @@ -335,11 +329,7 @@ abort: /* ok to ack, since user */ } static int -makerequest(request, name, tp, mode) - int request; - const char *name; - struct tftphdr *tp; - const char *mode; +makerequest(int request, const char *name, struct tftphdr *tp, const char *mode) { char *cp; @@ -376,9 +366,7 @@ struct errmsg { * offset by 100. */ static void -nak(error, peer) - int error; - struct sockaddr *peer; +nak(int error, const struct sockaddr *peer) { struct errmsg *pe; struct tftphdr *tp; @@ -403,10 +391,7 @@ nak(error, peer) } static void -tpacket(s, tp, n) - const char *s; - struct tftphdr *tp; - int n; +tpacket(const char *s, struct tftphdr *tp, int n) { static const char *opcodes[] = { "#0", "RRQ", "WRQ", "DATA", "ACK", "ERROR" }; @@ -445,23 +430,21 @@ struct timeval tstart; struct timeval tstop; static void -startclock() +startclock(void) { (void)gettimeofday(&tstart, NULL); } static void -stopclock() +stopclock(void) { (void)gettimeofday(&tstop, NULL); } static void -printstats(direction, amount) - const char *direction; - unsigned long amount; +printstats(const char *direction, unsigned long amount) { double delta; /* compute delta in 1/10's second units */ @@ -475,8 +458,7 @@ printstats(direction, amount) } static void -timer(sig) - int sig __unused; +timer(int sig __unused) { timeout += rexmtval; @@ -489,9 +471,7 @@ timer(sig) } static int -cmpport(sa, sb) - struct sockaddr *sa; - struct sockaddr *sb; +cmpport(const struct sockaddr *sa, const struct sockaddr *sb) { char a[NI_MAXSERV], b[NI_MAXSERV]; Modified: head/usr.bin/tftp/tftpsubs.c ============================================================================== --- head/usr.bin/tftp/tftpsubs.c Mon Oct 13 22:50:38 2008 (r183857) +++ head/usr.bin/tftp/tftpsubs.c Mon Oct 13 23:10:19 2008 (r183858) @@ -85,9 +85,8 @@ static struct tftphdr *rw_init(int); struct tftphdr *w_init(void) { return rw_init(0); } /* write-behind */ struct tftphdr *r_init(void) { return rw_init(1); } /* read-ahead */ -static struct tftphdr * -rw_init(x) /* init for either read-ahead or write-behind */ - int x; /* zero for write-behind, one for read-head */ +static struct tftphdr * /* init for either read-ahead or write-behind */ +rw_init(int x) /* zero for write-behind, one for read-head */ { newline = 0; /* init crlf flag */ prevchar = -1; @@ -103,10 +102,9 @@ rw_init(x) /* init for either read-ahe Free it and return next buffer filled with data. */ int -readit(file, dpp, convert) - FILE *file; /* file opened for read */ - struct tftphdr **dpp; - int convert; /* if true, convert to ascii */ +readit(FILE *file, /* file opened for read */ + struct tftphdr **dpp, + int convert) /* if true, convert to ascii */ { struct bf *b; @@ -126,9 +124,8 @@ readit(file, dpp, convert) * conversions are lf -> cr,lf and cr -> cr, nul */ void -read_ahead(file, convert) - FILE *file; /* file opened for read */ - int convert; /* if true, convert to ascii */ +read_ahead(FILE *file, /* file opened for read */ + int convert) /* if true, convert to ascii */ { register int i; register char *p; @@ -175,10 +172,7 @@ read_ahead(file, convert) available. */ int -writeit(file, dpp, ct, convert) - FILE *file; - struct tftphdr **dpp; - int ct, convert; +writeit(FILE *file, struct tftphdr **dpp, int ct, int convert) { bfs[current].counter = ct; /* set size of data to write */ current = !current; /* switch to other buffer */ @@ -196,9 +190,7 @@ writeit(file, dpp, ct, convert) * CR followed by anything else. In this case we leave it alone. */ int -write_behind(file, convert) - FILE *file; - int convert; +write_behind(FILE *file, int convert) { char *buf; int count; @@ -255,8 +247,7 @@ skipit: */ int -synchnet(f) - int f; /* socket to flush */ +synchnet(int f) /* socket to flush */ { int i, j = 0; char rbuf[PKTSIZE]; From owner-svn-src-head@FreeBSD.ORG Tue Oct 14 00:54:15 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5D57D1065687; Tue, 14 Oct 2008 00:54:15 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4B1658FC12; Tue, 14 Oct 2008 00:54:15 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9E0sF27091003; Tue, 14 Oct 2008 00:54:15 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9E0sFKY091002; Tue, 14 Oct 2008 00:54:15 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200810140054.m9E0sFKY091002@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 14 Oct 2008 00:54:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183859 - head/sys/dev/jme X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Oct 2008 00:54:15 -0000 Author: yongari Date: Tue Oct 14 00:54:15 2008 New Revision: 183859 URL: http://svn.freebsd.org/changeset/base/183859 Log: Make sure to read the last byte of EEPROM descriptor. Previously the last byte of the ethernet address was not read which in turn resulted in getting 5 out of the 6 bytes of ethernet address and always returned ENOENT. I did not notice the bug on FPGA version because of additional configuration data in EEPROM. Pointed out by: bouyer at NetBSD Modified: head/sys/dev/jme/if_jme.c Modified: head/sys/dev/jme/if_jme.c ============================================================================== --- head/sys/dev/jme/if_jme.c Mon Oct 13 23:10:19 2008 (r183858) +++ head/sys/dev/jme/if_jme.c Tue Oct 14 00:54:15 2008 (r183859) @@ -415,11 +415,8 @@ jme_eeprom_macaddr(struct jme_softc *sc) do { if (jme_eeprom_read_byte(sc, offset, &fup) != 0) break; - /* Check for the end of EEPROM descriptor. */ - if ((fup & JME_EEPROM_DESC_END) == JME_EEPROM_DESC_END) - break; - if ((uint8_t)JME_EEPROM_MKDESC(JME_EEPROM_FUNC0, - JME_EEPROM_PAGE_BAR1) == fup) { + if (JME_EEPROM_MKDESC(JME_EEPROM_FUNC0, JME_EEPROM_PAGE_BAR1) == + (fup & (JME_EEPROM_FUNC_MASK | JME_EEPROM_PAGE_MASK))) { if (jme_eeprom_read_byte(sc, offset + 1, ®) != 0) break; if (reg >= JME_PAR0 && @@ -431,6 +428,9 @@ jme_eeprom_macaddr(struct jme_softc *sc) match++; } } + /* Check for the end of EEPROM descriptor. */ + if ((fup & JME_EEPROM_DESC_END) == JME_EEPROM_DESC_END) + break; /* Try next eeprom descriptor. */ offset += JME_EEPROM_DESC_BYTES; } while (match != ETHER_ADDR_LEN && offset < JME_EEPROM_END); From owner-svn-src-head@FreeBSD.ORG Tue Oct 14 02:13:13 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4759B1065687; Tue, 14 Oct 2008 02:13:13 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 354148FC17; Tue, 14 Oct 2008 02:13:13 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9E2DDcL092617; Tue, 14 Oct 2008 02:13:13 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9E2DDl7092616; Tue, 14 Oct 2008 02:13:13 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <200810140213.m9E2DDl7092616@svn.freebsd.org> From: Ken Smith Date: Tue, 14 Oct 2008 02:13:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183860 - head/release X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Oct 2008 02:13:13 -0000 Author: kensmith Date: Tue Oct 14 02:13:12 2008 New Revision: 183860 URL: http://svn.freebsd.org/changeset/base/183860 Log: The thought of making more than one DVD image for a release really freaks me out. But it turns out we might be able to generalize a few of the other things RE uses to assemble the package trees for releases if the DVDs use a naming theme close to what is used for the CDROMS (disc1, disc2, etc). So change the name to dvd1. Hopefully this way src/release/scripts/{package-split.py,package-trees.sh} can be generalized instead of copied-and-hacked. MFC after: 5 days Modified: head/release/Makefile Modified: head/release/Makefile ============================================================================== --- head/release/Makefile Tue Oct 14 00:54:15 2008 (r183859) +++ head/release/Makefile Tue Oct 14 02:13:12 2008 (r183860) @@ -265,7 +265,7 @@ CD_BOOT= ${CD}/bootonly CD_DISC1= ${CD}/disc1 CD_DISC2= ${CD}/disc2 .if defined(MAKE_DVD) -CD_DVD= ${CD}/dvd +CD_DVD1= ${CD}/dvd1 .endif .if !defined(NODOC) CD_DOCS= ${CD}/docs @@ -930,13 +930,13 @@ cdrom.1: done .if defined(MAKE_DVD) @echo "Building DVD filesystem image as well as CDROM" - @mkdir -p ${CD_DVD}/${BUILDNAME} + @mkdir -p ${CD_DVD1}/${BUILDNAME} @for i in ${DISTRIBUTIONS} ; \ do \ if [ -d ${RD}/trees/$${i} ] ; then \ chflags -R noschg ${RD}/trees/$${i} || true ; \ ( cd ${RD}/trees/$${i} && \ - find . -depth -print | cpio -dumpl ${CD_DVD} ) ; \ + find . -depth -print | cpio -dumpl ${CD_DVD1} ) ; \ fi \ done .endif @@ -958,21 +958,21 @@ cdrom.1: @cp ${RD}/trees/base/boot/device.hints ${CD_LIVEFS}/boot/device.hints .endif .if defined(MAKE_DVD) - @cp -Rp ${RD}/kernels/GENERIC/ ${CD_DVD}/boot/kernel - @rm -f ${CD_DVD}/boot/kernel/*.symbols - @rm -f ${CD_DVD}/.profile - @cp ${.CURDIR}/fixit.profile ${CD_DVD}/.profile - @ln -sf /rescue ${CD_DVD}/stand + @cp -Rp ${RD}/kernels/GENERIC/ ${CD_DVD1}/boot/kernel + @rm -f ${CD_DVD1}/boot/kernel/*.symbols + @rm -f ${CD_DVD1}/.profile + @cp ${.CURDIR}/fixit.profile ${CD_DVD1}/.profile + @ln -sf /rescue ${CD_DVD1}/stand @echo "CD_VERSION = ${BUILDNAME}" > ${CD_LIVEFS}/cdrom.inf - @echo "CD_VERSION = ${BUILDNAME}" > ${CD_DVD}/cdrom.inf - @rm -f ${CD_DVD}/boot/loader.conf - @cp ${RD}/mfsroot/mfsroot.gz ${CD_DVD}/boot/mfsroot.gz - @echo 'mfsroot_load="YES"' > ${CD_DVD}/boot/loader.conf - @echo 'mfsroot_type="mfs_root"' >> ${CD_DVD}/boot/loader.conf - @echo 'mfsroot_name="/boot/mfsroot"' >> ${CD_DVD}/boot/loader.conf + @echo "CD_VERSION = ${BUILDNAME}" > ${CD_DVD1}/cdrom.inf + @rm -f ${CD_DVD1}/boot/loader.conf + @cp ${RD}/mfsroot/mfsroot.gz ${CD_DVD1}/boot/mfsroot.gz + @echo 'mfsroot_load="YES"' > ${CD_DVD1}/boot/loader.conf + @echo 'mfsroot_type="mfs_root"' >> ${CD_DVD1}/boot/loader.conf + @echo 'mfsroot_name="/boot/mfsroot"' >> ${CD_DVD1}/boot/loader.conf .if exists(${RD}/trees/base/boot/device.hints) - @rm -f ${CD_DVD}/boot/device.hints - @cp ${RD}/trees/base/boot/device.hints ${CD_DVD}/boot/device.hints + @rm -f ${CD_DVD1}/boot/device.hints + @cp ${RD}/trees/base/boot/device.hints ${CD_DVD1}/boot/device.hints .endif .endif touch ${.TARGET} @@ -1011,26 +1011,26 @@ cdrom.2: @echo "CD_VOLUME = 2" >> ${CD_DISC2}/cdrom.inf .if defined(MAKE_DVD) .if defined(MAKE_FLOPPIES) - @cd ${RD} && find floppies -print | cpio -dumpl ${CD_DVD} + @cd ${RD} && find floppies -print | cpio -dumpl ${CD_DVD1} .endif - @cd ${RD}/dists && find . -print | cpio -dumpl ${CD_DVD}/${BUILDNAME} + @cd ${RD}/dists && find . -print | cpio -dumpl ${CD_DVD1}/${BUILDNAME} .if !defined(NODOC) @for i in ${DIST_DOCS_ARCH_INDEP}; do \ cp ${RND}/${RELNOTES_LANG}/$$i/article.txt \ - ${CD_DVD}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \ + ${CD_DVD1}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \ cp ${RND}/${RELNOTES_LANG}/$$i/article.html \ - ${CD_DVD}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \ + ${CD_DVD1}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \ done @for i in ${DIST_DOCS_ARCH_DEP}; do \ cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.txt \ - ${CD_DVD}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \ + ${CD_DVD1}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \ cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.html \ - ${CD_DVD}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \ + ${CD_DVD1}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \ done - @cp ${RND}/${RELNOTES_LANG}/readme/docbook.css ${CD_DVD} + @cp ${RND}/${RELNOTES_LANG}/readme/docbook.css ${CD_DVD1} .endif - @echo "CD_VERSION = ${BUILDNAME}" > ${CD_DVD}/cdrom.inf - @echo "CD_VOLUME = 1" >> ${CD_DVD}/cdrom.inf + @echo "CD_VERSION = ${BUILDNAME}" > ${CD_DVD1}/cdrom.inf + @echo "CD_VOLUME = 1" >> ${CD_DVD1}/cdrom.inf .endif .if !defined(NODOC) echo "Building CDROM docs filesystem image" @@ -1038,7 +1038,7 @@ cdrom.2: @echo "CD_VERSION = ${BUILDNAME}" > ${CD_DOCS}/cdrom.inf @mkdir -p ${CD_DOCS}/usr/share/doc .if defined(MAKE_DVD) - @mkdir -p ${CD_DVD}/usr/share/doc + @mkdir -p ${CD_DVD1}/usr/share/doc .endif @for i in `ls ${CD_LIVEFS}/usr/share/doc`; do \ if [ -L ${CD_LIVEFS}/usr/share/doc/$$i -o \ @@ -1049,7 +1049,7 @@ cdrom.2: done .if defined(MAKE_DVD) @cd ${CD_DOCS}/usr/share/doc && find . -print | \ - cpio -dumpl ${CD_DVD}/usr/share/doc + cpio -dumpl ${CD_DVD1}/usr/share/doc .endif .endif touch ${.TARGET} @@ -1081,8 +1081,8 @@ CD_DISC1_PKGS= ${CD_PACKAGE_TREE}/disc1 .if exists(${CD_PACKAGE_TREE}/disc2) CD_DISC2_PKGS= ${CD_PACKAGE_TREE}/disc2 .endif -.if exists(${CD_PACKAGE_TREE}/dvd) -CD_DVD_PKGS= ${CD_PACKAGE_TREE}/dvd +.if exists(${CD_PACKAGE_TREE}/dvd1) +CD_DVD1_PKGS= ${CD_PACKAGE_TREE}/dvd1 .endif .endif .endif @@ -1106,8 +1106,8 @@ iso.1: .if defined(MAKE_DVD) @sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \ FreeBSD_Install \ - ${CD}/${BUILDNAME}-${TARGET}-dvd.iso ${CD_DVD} \ - ${CD_DVD_PKGS} + ${CD}/${BUILDNAME}-${TARGET}-dvd1.iso ${CD_DVD1} \ + ${CD_DVD1_PKGS} .endif .if !defined(NODOC) @sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh \ From owner-svn-src-head@FreeBSD.ORG Tue Oct 14 02:22:42 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1060) id 8F6481065678; Tue, 14 Oct 2008 02:22:42 +0000 (UTC) Date: Tue, 14 Oct 2008 02:22:42 +0000 From: Craig Rodrigues To: Attilio Rao Message-ID: <20081014022242.GA80660@crodrigues.org> References: <200810102123.m9ALNpou001340@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200810102123.m9ALNpou001340@svn.freebsd.org> User-Agent: Mutt/1.4.2.1i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r183754 - in head/sys: cddl/contrib/opensolaris/uts/common/fs/zfs fs/cd9660 fs/hpfs fs/msdosfs fs/ntfs fs/nwfs fs/smbfs fs/udf geom gnu/fs/ext2fs gnu/fs/xfs/FreeBSD kern nfsclient sys u... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Oct 2008 02:22:42 -0000 On Fri, Oct 10, 2008 at 09:23:51PM +0000, Attilio Rao wrote: > - error = vinvalbuf(vp, V_SAVE, curthread, 0, 0); > + error = vinvalbuf(vp, V_SAVE, 0, 0); > vnode_pager_setsize(vp, end); > #endif > } Hi, Can you update the vinvalbuf.9 man page (and any other man pages for functions which you changed with your commit)? Thanks. -- Craig Rodrigues rodrigc@crodrigues.org From owner-svn-src-head@FreeBSD.ORG Tue Oct 14 03:32:41 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DFEFF1065687; Tue, 14 Oct 2008 03:32:41 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CC9C38FC0A; Tue, 14 Oct 2008 03:32:41 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9E3Wfa1094388; Tue, 14 Oct 2008 03:32:41 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9E3WfEK094381; Tue, 14 Oct 2008 03:32:41 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <200810140332.m9E3WfEK094381@svn.freebsd.org> From: Nathan Whitehorn Date: Tue, 14 Oct 2008 03:32:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183863 - in head/sys/boot/powerpc: . boot1.chrp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Oct 2008 03:32:42 -0000 Author: nwhitehorn Date: Tue Oct 14 03:32:41 2008 New Revision: 183863 URL: http://svn.freebsd.org/changeset/base/183863 Log: Add a simple HFS boot block implementation for booting PowerPC macs. It creates a small HFS filesystem with a CHRP boot script and an early-stage bootloader derived from the sparc64 boot block. Obtained from: sparc64 Added: head/sys/boot/powerpc/boot1.chrp/ head/sys/boot/powerpc/boot1.chrp/Makefile (contents, props changed) head/sys/boot/powerpc/boot1.chrp/Makefile.hfs (contents, props changed) head/sys/boot/powerpc/boot1.chrp/boot1.c (contents, props changed) head/sys/boot/powerpc/boot1.chrp/bootinfo.txt (contents, props changed) head/sys/boot/powerpc/boot1.chrp/generate-hfs.sh (contents, props changed) head/sys/boot/powerpc/boot1.chrp/hfs.tmpl.bz2.uu (contents, props changed) Modified: head/sys/boot/powerpc/Makefile Modified: head/sys/boot/powerpc/Makefile ============================================================================== --- head/sys/boot/powerpc/Makefile Tue Oct 14 03:22:38 2008 (r183862) +++ head/sys/boot/powerpc/Makefile Tue Oct 14 03:32:41 2008 (r183863) @@ -1,5 +1,5 @@ # $FreeBSD$ -SUBDIR= ofw uboot +SUBDIR= boot1.chrp ofw uboot .include Added: head/sys/boot/powerpc/boot1.chrp/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/boot/powerpc/boot1.chrp/Makefile Tue Oct 14 03:32:41 2008 (r183863) @@ -0,0 +1,42 @@ +# $FreeBSD$ + +WITHOUT_SSP= + +PROG= boot1.elf +NEWVERSWHAT= "Open Firmware boot block" ${MACHINE_ARCH} +BINDIR?= /boot +INSTALLFLAGS= -b + +FILES= boot1.hfs +SRCS= boot1.c ashldi3.c + +INTERNALPROG= +NO_MAN= + +CFLAGS= -ffreestanding -msoft-float -Os -D_KERNEL \ + -I${.CURDIR}/../../common -I${.CURDIR}/../../../ +LDFLAGS=-nostdlib -static -N + +.include "${.CURDIR}/../Makefile.inc" +.PATH: ${.CURDIR}/../../../libkern ${.CURDIR} + +# The following inserts out objects into a template HFS +# created by generate-hfs.sh + +.include "${.CURDIR}/Makefile.hfs" + +boot1.hfs: boot1.elf bootinfo.txt + echo ${.OBJDIR} + uudecode ${.CURDIR}/hfs.tmpl.bz2.uu + mv hfs.tmpl.bz2 ${.TARGET}.bz2 + bzip2 -f -d ${.TARGET}.bz2 + dd if=boot1.elf of=${.TARGET} seek=${BOOT1_OFFSET} conv=notrunc + dd if=${.CURDIR}/bootinfo.txt of=${.TARGET} seek=${BOOTINFO_OFFSET} \ + conv=notrunc + +CLEANFILES= boot1.hfs + +boot1.o: ${.CURDIR}/../../common/ufsread.c + +.include + Added: head/sys/boot/powerpc/boot1.chrp/Makefile.hfs ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/boot/powerpc/boot1.chrp/Makefile.hfs Tue Oct 14 03:32:41 2008 (r183863) @@ -0,0 +1,4 @@ +# This file autogenerated by generate-hfs.sh - DO NOT EDIT +# $FreeBSD$ +BOOTINFO_OFFSET=0x58 +BOOT1_OFFSET=0x1c Added: head/sys/boot/powerpc/boot1.chrp/boot1.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/boot/powerpc/boot1.chrp/boot1.c Tue Oct 14 03:32:41 2008 (r183863) @@ -0,0 +1,764 @@ +/*- + * Copyright (c) 1998 Robert Nordier + * All rights reserved. + * Copyright (c) 2001 Robert Drehmel + * All rights reserved. + * + * Redistribution and use in source and binary forms are freely + * permitted provided that the above copyright notice and this + * paragraph and the following disclaimer are duplicated in all + * such forms. + * + * This software is provided "AS IS" and without any express or + * implied warranties, including, without limitation, the implied + * warranties of merchantability and fitness for a particular + * purpose. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#define _PATH_LOADER "/boot/loader" +#define _PATH_KERNEL "/boot/kernel/kernel" + +#define BSIZEMAX 16384 + +typedef int putc_func_t(char c, void *arg); +typedef int32_t ofwh_t; + +struct sp_data { + char *sp_buf; + u_int sp_len; + u_int sp_size; +}; + +static const char digits[] = "0123456789abcdef"; + +static char bootpath[128]; +static char bootargs[128]; + +static ofwh_t bootdev; + +static struct fs fs; +static ino_t inomap; +static char blkbuf[BSIZEMAX]; +static unsigned int fsblks; + +static uint32_t fs_off; + +int main(int ac, char **av); + +static void exit(int) __dead2; +static void load(const char *); +static int dskread(void *, u_int64_t, int); + +static void usage(void); + +static void bcopy(const void *src, void *dst, size_t len); +static void bzero(void *b, size_t len); + +static int mount(const char *device, int quiet); + +static void panic(const char *fmt, ...) __dead2; +static int printf(const char *fmt, ...); +static int putchar(char c, void *arg); +static int vprintf(const char *fmt, va_list ap); +static int vsnprintf(char *str, size_t sz, const char *fmt, va_list ap); + +static int __printf(const char *fmt, putc_func_t *putc, void *arg, va_list ap); +static int __putc(char c, void *arg); +static int __puts(const char *s, putc_func_t *putc, void *arg); +static int __sputc(char c, void *arg); +static char *__uitoa(char *buf, u_int val, int base); +static char *__ultoa(char *buf, u_long val, int base); + +/* + * Open Firmware interface functions + */ +typedef u_int32_t ofwcell_t; +typedef u_int32_t u_ofwh_t; +typedef int (*ofwfp_t)(void *); +ofwfp_t ofw; /* the prom Open Firmware entry */ +ofwh_t chosenh; + +void ofw_init(void *, int, int (*)(void *), char *, int); +static ofwh_t ofw_finddevice(const char *); +static ofwh_t ofw_open(const char *); +static int ofw_close(ofwh_t); +static int ofw_getprop(ofwh_t, const char *, void *, size_t); +static int ofw_setprop(ofwh_t, const char *, void *, size_t); +static int ofw_read(ofwh_t, void *, size_t); +static int ofw_write(ofwh_t, const void *, size_t); +static int ofw_claim(void *virt, size_t len, u_int align); +static int ofw_seek(ofwh_t, u_int64_t); +static void ofw_exit(void) __dead2; + +ofwh_t bootdevh; +ofwh_t stdinh, stdouth; + +__asm(" \n\ + .data \n\ +stack: \n\ + .space 16384 \n\ + \n\ + .text \n\ + .globl _start \n\ +_start: \n\ + lis %r1,stack@ha \n\ + addi %r1,%r1,stack@l \n\ + addi %r1,%r1,8192 \n\ + \n\ + b ofw_init \n\ +"); + +void +ofw_init(void *vpd, int res, int (*openfirm)(void *), char *arg, int argl) +{ + char *av[16]; + char *p; + int ac; + + ofw = openfirm; + + chosenh = ofw_finddevice("/chosen"); + ofw_getprop(chosenh, "stdin", &stdinh, sizeof(stdinh)); + ofw_getprop(chosenh, "stdout", &stdouth, sizeof(stdouth)); + ofw_getprop(chosenh, "bootargs", bootargs, sizeof(bootargs)); + ofw_getprop(chosenh, "bootpath", bootpath, sizeof(bootpath)); + + bootargs[sizeof(bootargs) - 1] = '\0'; + bootpath[sizeof(bootpath) - 1] = '\0'; + + p = bootpath; + while (*p != '\0') { + if (*p == ':') { + *(++p) = '\0'; + break; + } + p++; + } + + ac = 0; + p = bootargs; + for (;;) { + while (*p == ' ' && *p != '\0') + p++; + if (*p == '\0' || ac >= 16) + break; + av[ac++] = p; + while (*p != ' ' && *p != '\0') + p++; + if (*p != '\0') + *p++ = '\0'; + } + + exit(main(ac, av)); +} + +static ofwh_t +ofw_finddevice(const char *name) +{ + ofwcell_t args[] = { + (ofwcell_t)"finddevice", + 1, + 1, + (ofwcell_t)name, + 0 + }; + + if ((*ofw)(args)) { + printf("ofw_finddevice: name=\"%s\"\n", name); + return (1); + } + return (args[4]); +} + +static int +ofw_getprop(ofwh_t ofwh, const char *name, void *buf, size_t len) +{ + ofwcell_t args[] = { + (ofwcell_t)"getprop", + 4, + 1, + (u_ofwh_t)ofwh, + (ofwcell_t)name, + (ofwcell_t)buf, + len, + 0 + }; + + if ((*ofw)(args)) { + printf("ofw_getprop: ofwh=0x%x buf=%p len=%u\n", + ofwh, buf, len); + return (1); + } + return (0); +} + +static int +ofw_setprop(ofwh_t ofwh, const char *name, void *buf, size_t len) +{ + ofwcell_t args[] = { + (ofwcell_t)"setprop", + 4, + 1, + (u_ofwh_t)ofwh, + (ofwcell_t)name, + (ofwcell_t)buf, + len, + 0 + }; + + if ((*ofw)(args)) { + printf("ofw_setprop: ofwh=0x%x buf=%p len=%u\n", + ofwh, buf, len); + return (1); + } + return (0); +} + +static ofwh_t +ofw_open(const char *path) +{ + ofwcell_t args[] = { + (ofwcell_t)"open", + 1, + 1, + (ofwcell_t)path, + 0 + }; + + if ((*ofw)(args)) { + printf("ofw_open: path=\"%s\"\n", path); + return (-1); + } + return (args[4]); +} + +static int +ofw_close(ofwh_t devh) +{ + ofwcell_t args[] = { + (ofwcell_t)"close", + 1, + 0, + (u_ofwh_t)devh + }; + + if ((*ofw)(args)) { + printf("ofw_close: devh=0x%x\n", devh); + return (1); + } + return (0); +} + +static int +ofw_claim(void *virt, size_t len, u_int align) +{ + ofwcell_t args[] = { + (ofwcell_t)"claim", + 3, + 1, + (ofwcell_t)virt, + len, + align, + 0, + 0 + }; + + if ((*ofw)(args)) { + printf("ofw_claim: virt=%p len=%u\n", virt, len); + return (1); + } + + return (0); +} + +static int +ofw_read(ofwh_t devh, void *buf, size_t len) +{ + ofwcell_t args[] = { + (ofwcell_t)"read", + 3, + 1, + (u_ofwh_t)devh, + (ofwcell_t)buf, + len, + 0 + }; + + if ((*ofw)(args)) { + printf("ofw_read: devh=0x%x buf=%p len=%u\n", devh, buf, len); + return (1); + } + return (0); +} + +static int +ofw_write(ofwh_t devh, const void *buf, size_t len) +{ + ofwcell_t args[] = { + (ofwcell_t)"write", + 3, + 1, + (u_ofwh_t)devh, + (ofwcell_t)buf, + len, + 0 + }; + + if ((*ofw)(args)) { + printf("ofw_write: devh=0x%x buf=%p len=%u\n", devh, buf, len); + return (1); + } + return (0); +} + +static int +ofw_seek(ofwh_t devh, u_int64_t off) +{ + ofwcell_t args[] = { + (ofwcell_t)"seek", + 3, + 1, + (u_ofwh_t)devh, + off >> 32, + off, + 0 + }; + + if ((*ofw)(args)) { + printf("ofw_seek: devh=0x%x off=0x%lx\n", devh, off); + return (1); + } + return (0); +} + +static void +ofw_exit(void) +{ + ofwcell_t args[3]; + + args[0] = (ofwcell_t)"exit"; + args[1] = 0; + args[2] = 0; + + for (;;) + (*ofw)(args); +} + +static void +bcopy(const void *src, void *dst, size_t len) +{ + const char *s = src; + char *d = dst; + + while (len-- != 0) + *d++ = *s++; +} + +static void +memcpy(void *dst, const void *src, size_t len) +{ + bcopy(src, dst, len); +} + +static void +bzero(void *b, size_t len) +{ + char *p = b; + + while (len-- != 0) + *p++ = 0; +} + +static int +strcmp(const char *s1, const char *s2) +{ + for (; *s1 == *s2 && *s1; s1++, s2++) + ; + return ((u_char)*s1 - (u_char)*s2); +} + +#include "ufsread.c" + +int +main(int ac, char **av) +{ + const char *path; + char bootpath_full[255]; + int i, len; + + path = _PATH_LOADER; + for (i = 0; i < ac; i++) { + switch (av[i][0]) { + case '-': + switch (av[i][1]) { + default: + usage(); + } + break; + default: + path = av[i]; + break; + } + } + + printf(" \n>> FreeBSD/powerpc Open Firmware boot block\n" + " Boot path: %s\n" + " Boot loader: %s\n", bootpath, path); + + len = 0; + while (bootpath[len] != '\0') len++; + + memcpy(bootpath_full,bootpath,len+1); + + if (bootpath_full[len-1] == ':') { + for (i = 0; i < 16; i++) { + if (i < 10) { + bootpath_full[len] = i + '0'; + bootpath_full[len+1] = '\0'; + } else { + bootpath_full[len] = '1'; + bootpath_full[len+1] = i - 10 + '0'; + bootpath_full[len+2] = '\0'; + } + + if (mount(bootpath_full,1) >= 0) + break; + + if (bootdev > 0) + ofw_close(bootdev); + } + + if (i >= 16) + panic("mount"); + } else { + if (mount(bootpath_full,0) == -1) + panic("mount"); + } + + printf(" Boot volume: %s\n",bootpath_full); + ofw_setprop(chosenh, "bootargs", bootpath_full, len+2); + load(path); + return (1); +} + +static void +usage(void) +{ + + printf("usage: boot device [/path/to/loader]\n"); + exit(1); +} + +static void +exit(int code) +{ + + ofw_exit(); +} + +static struct dmadat __dmadat; + +static int +mount(const char *device, int quiet) +{ + + dmadat = &__dmadat; + if ((bootdev = ofw_open(device)) == -1) { + printf("mount: can't open device\n"); + return (-1); + } + if (fsread(0, NULL, 0)) { + if (!quiet) + printf("mount: can't read superblock\n"); + return (-1); + } + return (0); +} + +static void +load(const char *fname) +{ + Elf32_Ehdr eh; + Elf32_Phdr ph; + caddr_t p; + ino_t ino; + int i; + + if ((ino = lookup(fname)) == 0) { + printf("File %s not found\n", fname); + return; + } + if (fsread(ino, &eh, sizeof(eh)) != sizeof(eh)) { + printf("Can't read elf header\n"); + return; + } + if (!IS_ELF(eh)) { + printf("Not an ELF file\n"); + return; + } + for (i = 0; i < eh.e_phnum; i++) { + fs_off = eh.e_phoff + i * eh.e_phentsize; + if (fsread(ino, &ph, sizeof(ph)) != sizeof(ph)) { + printf("Can't read program header %d\n", i); + return; + } + if (ph.p_type != PT_LOAD) + continue; + fs_off = ph.p_offset; + p = (caddr_t)ph.p_vaddr; + ofw_claim(p,(ph.p_filesz > ph.p_memsz) ? + ph.p_filesz : ph.p_memsz,0); + if (fsread(ino, p, ph.p_filesz) != ph.p_filesz) { + printf("Can't read content of section %d\n", i); + return; + } + if (ph.p_filesz != ph.p_memsz) + bzero(p + ph.p_filesz, ph.p_memsz - ph.p_filesz); + } + ofw_close(bootdev); + (*(void (*)(void *, int, ofwfp_t, char *, int))eh.e_entry)(NULL, 0, + ofw,NULL,0); +} + +static int +dskread(void *buf, u_int64_t lba, int nblk) +{ + /* + * The Open Firmware should open the correct partition for us. + * That means, if we read from offset zero on an open instance handle, + * we should read from offset zero of that partition. + */ + ofw_seek(bootdev, lba * DEV_BSIZE); + ofw_read(bootdev, buf, nblk * DEV_BSIZE); + return (0); +} + +static void +panic(const char *fmt, ...) +{ + char buf[128]; + va_list ap; + + va_start(ap, fmt); + vsnprintf(buf, sizeof buf, fmt, ap); + printf("panic: %s\n", buf); + va_end(ap); + + exit(1); +} + +static int +printf(const char *fmt, ...) +{ + va_list ap; + int ret; + + va_start(ap, fmt); + ret = vprintf(fmt, ap); + va_end(ap); + return (ret); +} + +static int +putchar(char c, void *arg) +{ + char buf; + + if (c == '\n') { + buf = '\r'; + ofw_write(stdouth, &buf, 1); + } + buf = c; + ofw_write(stdouth, &buf, 1); + return (1); +} + +static int +vprintf(const char *fmt, va_list ap) +{ + int ret; + + ret = __printf(fmt, putchar, 0, ap); + return (ret); +} + +static int +vsnprintf(char *str, size_t sz, const char *fmt, va_list ap) +{ + struct sp_data sp; + int ret; + + sp.sp_buf = str; + sp.sp_len = 0; + sp.sp_size = sz; + ret = __printf(fmt, __sputc, &sp, ap); + return (ret); +} + +static int +__printf(const char *fmt, putc_func_t *putc, void *arg, va_list ap) +{ + char buf[(sizeof(long) * 8) + 1]; + char *nbuf; + u_long ul; + u_int ui; + int lflag; + int sflag; + char *s; + int pad; + int ret; + int c; + + nbuf = &buf[sizeof buf - 1]; + ret = 0; + while ((c = *fmt++) != 0) { + if (c != '%') { + ret += putc(c, arg); + continue; + } + lflag = 0; + sflag = 0; + pad = 0; +reswitch: c = *fmt++; + switch (c) { + case '#': + sflag = 1; + goto reswitch; + case '%': + ret += putc('%', arg); + break; + case 'c': + c = va_arg(ap, int); + ret += putc(c, arg); + break; + case 'd': + if (lflag == 0) { + ui = (u_int)va_arg(ap, int); + if (ui < (int)ui) { + ui = -ui; + ret += putc('-', arg); + } + s = __uitoa(nbuf, ui, 10); + } else { + ul = (u_long)va_arg(ap, long); + if (ul < (long)ul) { + ul = -ul; + ret += putc('-', arg); + } + s = __ultoa(nbuf, ul, 10); + } + ret += __puts(s, putc, arg); + break; + case 'l': + lflag = 1; + goto reswitch; + case 'o': + if (lflag == 0) { + ui = (u_int)va_arg(ap, u_int); + s = __uitoa(nbuf, ui, 8); + } else { + ul = (u_long)va_arg(ap, u_long); + s = __ultoa(nbuf, ul, 8); + } + ret += __puts(s, putc, arg); + break; + case 'p': + ul = (u_long)va_arg(ap, void *); + s = __ultoa(nbuf, ul, 16); + ret += __puts("0x", putc, arg); + ret += __puts(s, putc, arg); + break; + case 's': + s = va_arg(ap, char *); + ret += __puts(s, putc, arg); + break; + case 'u': + if (lflag == 0) { + ui = va_arg(ap, u_int); + s = __uitoa(nbuf, ui, 10); + } else { + ul = va_arg(ap, u_long); + s = __ultoa(nbuf, ul, 10); + } + ret += __puts(s, putc, arg); + break; + case 'x': + if (lflag == 0) { + ui = va_arg(ap, u_int); + s = __uitoa(nbuf, ui, 16); + } else { + ul = va_arg(ap, u_long); + s = __ultoa(nbuf, ul, 16); + } + if (sflag) + ret += __puts("0x", putc, arg); + ret += __puts(s, putc, arg); + break; + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + pad = pad * 10 + c - '0'; + goto reswitch; + default: + break; + } + } + return (ret); +} + +static int +__sputc(char c, void *arg) +{ + struct sp_data *sp; + + sp = arg; + if (sp->sp_len < sp->sp_size) + sp->sp_buf[sp->sp_len++] = c; + sp->sp_buf[sp->sp_len] = '\0'; + return (1); +} + +static int +__puts(const char *s, putc_func_t *putc, void *arg) +{ + const char *p; + int ret; + + ret = 0; + for (p = s; *p != '\0'; p++) + ret += putc(*p, arg); + return (ret); +} + +static char * +__uitoa(char *buf, u_int ui, int base) +{ + char *p; + + p = buf; + *p = '\0'; + do + *--p = digits[ui % base]; + while ((ui /= base) != 0); + return (p); +} + +static char * +__ultoa(char *buf, u_long ul, int base) +{ + char *p; + + p = buf; + *p = '\0'; + do + *--p = digits[ul % base]; + while ((ul /= base) != 0); + return (p); +} Added: head/sys/boot/powerpc/boot1.chrp/bootinfo.txt ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/boot/powerpc/boot1.chrp/bootinfo.txt Tue Oct 14 03:32:41 2008 (r183863) @@ -0,0 +1,13 @@ + +FreeBSD/powerpc bootloader +FreeBSD + $FreeBSD$ + + +MacRISC MacRISC3 MacRISC4 + + +boot &device;:&partition;,\ppc\boot1.elf + + + Added: head/sys/boot/powerpc/boot1.chrp/generate-hfs.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/boot/powerpc/boot1.chrp/generate-hfs.sh Tue Oct 14 03:32:41 2008 (r183863) @@ -0,0 +1,64 @@ +#!/bin/sh + +# This script generates the dummy HFS filesystem used for the PowerPC boot +# blocks. It uses hfsutils (emulators/hfsutils) to generate a template +# filesystem with the relevant interesting files. These are then found by +# grep, and the offsets written to a Makefile snippet. +# +# Because of licensing concerns, and because it is overkill, we do not +# distribute hfsutils as a build tool. If you need to regenerate the HFS +# template (e.g. because the boot block or the CHRP script have grown), +# you must install it from ports. + +# $FreeBSD$ + +HFS_SIZE=1600 #Size in 512-byte blocks of the produced image + +CHRPBOOT_SIZE=2k +BOOT1_SIZE=30k + +# Generate 800K HFS image +OUTPUT_FILE=hfs.tmpl + +dd if=/dev/zero of=$OUTPUT_FILE bs=512 count=$HFS_SIZE +hformat -l "FreeBSD Bootstrap" $OUTPUT_FILE +hmount $OUTPUT_FILE + +# Create and bless a directory for the boot loader +hmkdir ppc +hattrib -b ppc +hcd ppc + +# Make two dummy files for the the CHRP boot script and boot1 +echo 'Bootinfo START' | dd of=bootinfo.txt.tmp cbs=$CHRPBOOT_SIZE count=1 conv=block +echo 'Boot1 START' | dd of=boot1.elf.tmp cbs=$BOOT1_SIZE count=1 conv=block + +hcopy boot1.elf.tmp :boot1.elf +hcopy bootinfo.txt.tmp :bootinfo.txt +hattrib -c chrp -t tbxi bootinfo.txt +humount + +rm bootinfo.txt.tmp +rm boot1.elf.tmp + +# Locate the offsets of the two fake files +BOOTINFO_OFFSET=$(hd $OUTPUT_FILE | grep 'Bootinfo START' | cut -f 1 -d ' ') +BOOT1_OFFSET=$(hd $OUTPUT_FILE | grep 'Boot1 START' | cut -f 1 -d ' ') + +# Convert to numbers of blocks +BOOTINFO_OFFSET=$(echo 0x$BOOTINFO_OFFSET | awk '{printf("%x\n",$1/512);}') +BOOT1_OFFSET=$(echo 0x$BOOT1_OFFSET | awk '{printf("%x\n",$1/512);}') + +echo '# This file autogenerated by generate-hfs.sh - DO NOT EDIT' > Makefile.hfs +echo '# $FreeBSD$' >> Makefile.hfs +echo "BOOTINFO_OFFSET=0x$BOOTINFO_OFFSET" >> Makefile.hfs +echo "BOOT1_OFFSET=0x$BOOT1_OFFSET" >> Makefile.hfs + +bzip2 $OUTPUT_FILE +echo 'HFS template boot filesystem created by generate-hfs.sh' > $OUTPUT_FILE.bz2.uu +echo 'DO NOT EDIT' >> $OUTPUT_FILE.bz2.uu +echo '$FreeBSD$' >> $OUTPUT_FILE.bz2.uu + +uuencode $OUTPUT_FILE.bz2 $OUTPUT_FILE.bz2 >> $OUTPUT_FILE.bz2.uu +rm $OUTPUT_FILE.bz2 + Added: head/sys/boot/powerpc/boot1.chrp/hfs.tmpl.bz2.uu ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/boot/powerpc/boot1.chrp/hfs.tmpl.bz2.uu Tue Oct 14 03:32:41 2008 (r183863) @@ -0,0 +1,18 @@ +HFS template boot filesystem created by generate-hfs.sh +DO NOT EDIT +$FreeBSD$ +begin 644 hfs.tmpl.bz2 +M0EIH.3%!62936?(HJX\``"]_]?___O)20>!4M2$>0#MUW$1$``$!$``"2!`( +M4EG``>G*VV3"22334_2(/*>ID,@``:#U&"-#(!IZ0`)$HIY0>B-#(/4T```& +M@R:`&@``<:,F1A&(!A-!@$T&@9,FC)D,(#!4E-*--31ZAB!DT!ID:#$81HT& +M@9-!Z::C:E=SZCC1((92M^1Q@3&>="[<2FD((A[AT#`[('#?MSV(S,>HOI'#2,"EJ0PU5).T`PX,54O,RTW8-",N1`R>?SL"+?Q51[H]# +MJ1C5"]BDBF1UJ!Y`J$WTC]QAFZ%Q21$J,I&0,0?9?DPU!Z>$9.380JJCO$Q8 +MXZTX)GQCCGNC%G1BIDBHTK#J9N0,M[85QC:.'>]#,GPRAALU*=)2`$ND22<. +-VK/^+N2*<*$AY%%7'@`` +` +end From owner-svn-src-head@FreeBSD.ORG Tue Oct 14 03:38:03 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 470501065687; Tue, 14 Oct 2008 03:38:03 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CACE28FC1E; Tue, 14 Oct 2008 03:38:02 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9E3c2Go094523; Tue, 14 Oct 2008 03:38:02 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9E3c2b4094519; Tue, 14 Oct 2008 03:38:02 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810140338.m9E3c2b4094519@svn.freebsd.org> From: Edwin Groothuis Date: Tue, 14 Oct 2008 03:38:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183864 - head/share/zoneinfo X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Oct 2008 03:38:03 -0000 Author: edwin Date: Tue Oct 14 03:38:02 2008 New Revision: 183864 URL: http://svn.freebsd.org/changeset/base/183864 Log: MFV of r183861: Vendor import of tzdata2008h - Minor update for Mauritius (which I don't understand) - Syria goes to DST at 1 November instead of 1 October. - Niue is now located at the right side of the equator. Modified: head/share/zoneinfo/ (props changed) head/share/zoneinfo/africa head/share/zoneinfo/asia head/share/zoneinfo/southamerica head/share/zoneinfo/zone.tab Modified: head/share/zoneinfo/africa ============================================================================== --- head/share/zoneinfo/africa Tue Oct 14 03:32:41 2008 (r183863) +++ head/share/zoneinfo/africa Tue Oct 14 03:38:02 2008 (r183864) @@ -1,4 +1,4 @@ -# @(#)africa 8.16 +# @(#)africa 8.17 #
 
 # This data is by no means authoritative; if you think you know better,
@@ -453,11 +453,19 @@ Zone Africa/Nouakchott	-1:03:48 -	LMT	19
 # year 2008 - 2009 will, therefore, be effective as from 26 October 2008
 # and end on 29 March 2009.
 
+# From Ed Maste (2008-10-07):
+# THE TIME BILL (No. XXVII of 2008) Explanatory Memorandum states the
+# beginning / ending of summer time is 2 o'clock standard time in the
+# morning of the last Sunday of October / last Sunday of March.
+# 
+# http://www.gov.mu/portal/goc/assemblysite/file/bill2708.pdf
+# 
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule Mauritius	1982	only	-	Oct	10	0:00	1:00	S
 Rule Mauritius	1983	only	-	Mar	21	0:00	0	-
-Rule Mauritius	2008	max	-	Oct	lastSun	2:00	1:00	S
-Rule Mauritius	2009	max	-	Mar	lastSun	2:00	0	-
+Rule Mauritius	2008	max	-	Oct	lastSun	2:00s	1:00	S
+Rule Mauritius	2009	max	-	Mar	lastSun	2:00s	0	-
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone Indian/Mauritius	3:50:00 -	LMT	1907		# Port Louis
 			4:00 Mauritius	MU%sT	# Mauritius Time

Modified: head/share/zoneinfo/asia
==============================================================================
--- head/share/zoneinfo/asia	Tue Oct 14 03:32:41 2008	(r183863)
+++ head/share/zoneinfo/asia	Tue Oct 14 03:38:02 2008	(r183864)
@@ -1,4 +1,4 @@
-# @(#)asia	8.23
+# @(#)asia	8.24
 # 
 
 # This data is by no means authoritative; if you think you know better,
@@ -1957,8 +1957,20 @@ Rule	Syria	2007	only	-	Nov	 Fri>=1	0:00	
 # compilers can't handle  or having multiple Rules (a la Israel).
 # For now, use "Apr Fri>=1", and go with IATA on a uniform Sep 30 end.
 
+# From Steffen Thorsen (2008-10-07):
+# Syria has now officially decided to end DST on 2008-11-01 this year,
+# according to the following article in the Syrian Arab News Agency (SANA).
+#
+# The article is in Arabic, and seems to tell that they will go back to
+# winter time on 2008-11-01 at 00:00 local daylight time (delaying/setting
+# clocks back 60 minutes).
+#
+# 
+# http://sana.sy/ara/2/2008/10/07/195459.htm
+# 
+
 Rule	Syria	2008	max	-	Apr	Fri>=1	0:00	1:00	S
-Rule	Syria	2008	max	-	Oct	1	0:00	0	-
+Rule	Syria	2008	max	-	Nov	1	0:00	0	-
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Damascus	2:25:12 -	LMT	1920	# Dimashq

Modified: head/share/zoneinfo/southamerica
==============================================================================
--- head/share/zoneinfo/southamerica	Tue Oct 14 03:32:41 2008	(r183863)
+++ head/share/zoneinfo/southamerica	Tue Oct 14 03:38:02 2008	(r183864)
@@ -1,4 +1,4 @@
-# @(#)southamerica	8.29
+# @(#)southamerica	8.30
 # 
 
 # This data is by no means authoritative; if you think you know better,
@@ -177,6 +177,22 @@ Rule	Arg	2000	only	-	Mar	3	0:00	0	-
 # http://www.impulsobaires.com.ar/nota.php?id=57832 (in spanish)
 # 
 
+# From Rodrigo Severo (2008-10-06):
+# Here is some info available at a Gentoo bug related to TZ on Argentina's DST:
+# ...
+# ------- Comment #1 from [jmdocile]  2008-10-06 16:28 0000 -------
+# Hi, there is a problem with timezone-data-2008e and maybe with
+# timezone-data-2008f
+# Argentinian law [Number] 25.155 is no longer valid.
+# 
+# http://www.infoleg.gov.ar/infolegInternet/anexos/60000-64999/60036/norma.htm
+# 
+# The new one is law [Number] 26.350
+# 
+# http://www.infoleg.gov.ar/infolegInternet/anexos/135000-139999/136191/norma.htm
+# 
+# So there is no summer time in Argentina for now.
+
 Rule	Arg	2007	only	-	Dec	30	0:00	1:00	S
 Rule	Arg	2008	max	-	Mar	Sun>=15	0:00	0	-
 Rule	Arg	2008	max	-	Oct	Sun>=15	0:00	1:00	S

Modified: head/share/zoneinfo/zone.tab
==============================================================================
--- head/share/zoneinfo/zone.tab	Tue Oct 14 03:32:41 2008	(r183863)
+++ head/share/zoneinfo/zone.tab	Tue Oct 14 03:38:02 2008	(r183864)
@@ -1,4 +1,4 @@
-# @(#)zone.tab	8.18
+# @(#)zone.tab	8.19
 #
 # TZ zone descriptions
 #
@@ -293,7 +293,7 @@ NL	+5222+00454	Europe/Amsterdam
 NO	+5955+01045	Europe/Oslo
 NP	+2743+08519	Asia/Katmandu
 NR	-0031+16655	Pacific/Nauru
-NU	-1901+16955	Pacific/Niue
+NU	-1901-16955	Pacific/Niue
 NZ	-3652+17446	Pacific/Auckland	most locations
 NZ	-4357-17633	Pacific/Chatham	Chatham Islands
 OM	+2336+05835	Asia/Muscat

From owner-svn-src-head@FreeBSD.ORG  Tue Oct 14 04:09:34 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2AF4210656A5;
	Tue, 14 Oct 2008 04:09:34 +0000 (UTC)
	(envelope-from edwin@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 199D68FC0C;
	Tue, 14 Oct 2008 04:09:34 +0000 (UTC)
	(envelope-from edwin@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9E49XKR095104;
	Tue, 14 Oct 2008 04:09:33 GMT (envelope-from edwin@svn.freebsd.org)
Received: (from edwin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9E49XFn095103;
	Tue, 14 Oct 2008 04:09:33 GMT (envelope-from edwin@svn.freebsd.org)
Message-Id: <200810140409.m9E49XFn095103@svn.freebsd.org>
From: Edwin Groothuis 
Date: Tue, 14 Oct 2008 04:09:33 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183865 - head/share/zoneinfo
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 14 Oct 2008 04:09:34 -0000

Author: edwin
Date: Tue Oct 14 04:09:33 2008
New Revision: 183865
URL: http://svn.freebsd.org/changeset/base/183865

Log:
  update the manual on how to import and MFV new tzdata releases

Modified:
  head/share/zoneinfo/Makefile

Modified: head/share/zoneinfo/Makefile
==============================================================================
--- head/share/zoneinfo/Makefile	Tue Oct 14 03:38:02 2008	(r183864)
+++ head/share/zoneinfo/Makefile	Tue Oct 14 04:09:33 2008	(r183865)
@@ -17,17 +17,15 @@
 # $ cd ~/svn/vendor/tzdata
 # $ svn cp svn+ssh://svn.freebsd.org/base/vendor/tzdata/dist \
 #	svn+ssh://svn.freebsd.org/base/vendor/tzdata/tzdata2008X
-# $ svn update
+# $ svn update	# Commit message: "Tag of tzdata2008X"
 #
 # Merge-from-vendor
 #
-# $ cd ~svn/head/share/zoneinfo
+# $ cd ~/svn/head/share/zoneinfo
 # $ svn update
-# $ svn merge --accept=postpone \
+# $ svn merge -c X --accept=postpone \
 #	svn+ssh://svn.freebsd.org/base/vendor/tzdata/dist .
-# $ svn diff --no-diff-deleted \
-#	--old=svn+ssh://svn.freebsd.org/base/vendor/tzdata/dist --new=.
-# $ svn commit
+# $ svn update	# Commit message: "MFV of tzdata2008X"
 #
 
 CLEANFILES+=	yearistype

From owner-svn-src-head@FreeBSD.ORG  Tue Oct 14 07:05:21 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 70BA41065697;
	Tue, 14 Oct 2008 07:05:21 +0000 (UTC) (envelope-from raj@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5D6148FC2B;
	Tue, 14 Oct 2008 07:05:21 +0000 (UTC) (envelope-from raj@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9E75Lf4098310;
	Tue, 14 Oct 2008 07:05:21 GMT (envelope-from raj@svn.freebsd.org)
Received: (from raj@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9E75K3x098307;
	Tue, 14 Oct 2008 07:05:20 GMT (envelope-from raj@svn.freebsd.org)
Message-Id: <200810140705.m9E75K3x098307@svn.freebsd.org>
From: Rafal Jaworowski 
Date: Tue, 14 Oct 2008 07:05:20 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183866 - head/sys/dev/usb
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 14 Oct 2008 07:05:21 -0000

Author: raj
Date: Tue Oct 14 07:05:20 2008
New Revision: 183866
URL: http://svn.freebsd.org/changeset/base/183866

Log:
  Mbus attachment for USB EHCI integrated controller on Marvell chips.
  
  This includes workarounds required for the ehci(4) to handle some non-standard
  behaviour of these devices.
  
  Obtained from:	Marvell, Semihalf

Added:
  head/sys/dev/usb/ehci_mbus.c   (contents, props changed)
Modified:
  head/sys/dev/usb/ehci.c
  head/sys/dev/usb/ehcivar.h

Modified: head/sys/dev/usb/ehci.c
==============================================================================
--- head/sys/dev/usb/ehci.c	Tue Oct 14 04:09:33 2008	(r183865)
+++ head/sys/dev/usb/ehci.c	Tue Oct 14 07:05:20 2008	(r183866)
@@ -351,8 +351,12 @@ ehci_hcreset(ehci_softc_t *sc)
 	for (i = 0; i < 100; i++) {
 		usb_delay_ms(&sc->sc_bus, 1);
 		hcr = EOREAD4(sc, EHCI_USBCMD) & EHCI_CMD_HCRESET;
-		if (!hcr)
+		if (!hcr) {
+			if (sc->sc_flags & EHCI_SCFLG_SETMODE)
+				EOWRITE4(sc,  0x68, 0x3);
+
 			return (USBD_NORMAL_COMPLETION);
+		}
 	}
 	printf("%s: reset timeout\n", device_get_nameunit(sc->sc_bus.bdev));
 	return (USBD_IOERROR);
@@ -2194,7 +2198,18 @@ ehci_root_ctrl_start(usbd_xfer_handle xf
 		v = EOREAD4(sc, EHCI_PORTSC(index));
 		DPRINTFN(8,("ehci_root_ctrl_start: port status=0x%04x\n",
 			    v));
+
 		i = UPS_HIGH_SPEED;
+
+		if (sc->sc_flags & EHCI_SCFLG_FORCESPEED) {
+			if ((v & 0xc000000) == 0x8000000)
+				i = UPS_HIGH_SPEED;
+			else if ((v & 0xc000000) == 0x4000000)
+				i = UPS_LOW_SPEED;
+			else
+				i = 0;
+		}
+
 		if (v & EHCI_PS_CS)	i |= UPS_CURRENT_CONNECT_STATUS;
 		if (v & EHCI_PS_PE)	i |= UPS_PORT_ENABLED;
 		if (v & EHCI_PS_SUSP)	i |= UPS_SUSPEND;
@@ -2249,7 +2264,11 @@ ehci_root_ctrl_start(usbd_xfer_handle xf
 				goto ret;
 			}
 			/* Terminate reset sequence. */
-			EOWRITE4(sc, port, v);
+			if (sc->sc_flags & EHCI_SCFLG_NORESTERM)
+				;
+			else
+				EOWRITE4(sc, port, v);
+
 			/* Wait for HC to complete reset. */
 			usb_delay_ms(&sc->sc_bus, EHCI_PORT_RESET_COMPLETE);
 			if (sc->sc_dying) {

Added: head/sys/dev/usb/ehci_mbus.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/dev/usb/ehci_mbus.c	Tue Oct 14 07:05:20 2008	(r183866)
@@ -0,0 +1,318 @@
+/*-
+ * Copyright (C) 2008 MARVELL INTERNATIONAL LTD.
+ * All rights reserved.
+ *
+ * Developed by Semihalf.
+ *
+ * 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.
+ * 3. Neither the name of MARVELL nor the names of contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY 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 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.
+ */
+
+/*
+ * MBus attachment driver for the USB Enhanced Host Controller.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include "opt_bus.h"
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+#define EHCI_VENDORID_MRVL	0x1286
+#define EHCI_HC_DEVSTR		"Marvell Integrated USB 2.0 controller"
+
+static device_attach_t ehci_mbus_attach;
+static device_detach_t ehci_mbus_detach;
+static device_shutdown_t ehci_mbus_shutdown;
+static device_suspend_t ehci_mbus_suspend;
+static device_resume_t ehci_mbus_resume;
+
+static int
+ehci_mbus_suspend(device_t self)
+{
+	ehci_softc_t *sc;
+	int err;
+
+	err = bus_generic_suspend(self);
+	if (err)
+		return (err);
+
+	sc = device_get_softc(self);
+	ehci_power(PWR_SUSPEND, sc);
+
+	return (0);
+}
+
+static int
+ehci_mbus_resume(device_t self)
+{
+	ehci_softc_t *sc;
+
+	sc = device_get_softc(self);
+
+	ehci_power(PWR_RESUME, sc);
+	bus_generic_resume(self);
+
+	return (0);
+}
+
+static int
+ehci_mbus_shutdown(device_t self)
+{
+	ehci_softc_t *sc;
+	int err;
+
+	err = bus_generic_shutdown(self);
+	if (err)
+		return (err);
+
+	sc = device_get_softc(self);
+	ehci_shutdown(sc);
+
+	return (0);
+}
+
+static int
+ehci_mbus_probe(device_t self)
+{
+
+	device_set_desc(self, EHCI_HC_DEVSTR);
+
+	return (BUS_PROBE_DEFAULT);
+}
+
+static int
+ehci_mbus_attach(device_t self)
+{
+	ehci_softc_t *sc;
+	bus_space_handle_t bsh;
+	int err, rid;
+
+	sc = device_get_softc(self);
+	sc->sc_bus.usbrev = USBREV_2_0;
+
+	rid = 0;
+	sc->io_res = bus_alloc_resource_any(self, SYS_RES_MEMORY, &rid, RF_ACTIVE);
+	if (!sc->io_res) {
+		device_printf(self, "Could not map memory\n");
+		return (ENXIO);
+	}
+	sc->iot = rman_get_bustag(sc->io_res);
+	bsh = rman_get_bushandle(sc->io_res);
+
+	/*
+	 * Marvell EHCI host controller registers start at certain offset within
+	 * the whole USB registers range, so create a subregion for the host
+	 * mode configuration purposes.
+	 */
+	if (bus_space_subregion(sc->iot, bsh, MV_USB_HOST_OFST,
+	    MV_USB_SIZE - MV_USB_HOST_OFST, &sc->ioh) != 0)
+		panic("%s: unable to subregion USB host registers",
+		    device_get_name(self));
+	sc->sc_size = MV_USB_SIZE - MV_USB_HOST_OFST;
+
+	/*
+	 * Notice: Marvell EHCI controller has TWO interrupt lines, so make sure to
+	 * use the correct rid for the main one (controller interrupt) --
+	 * refer to obio_devices[] for the right resource number to use here.
+	 */
+	rid = 1;
+	sc->irq_res = bus_alloc_resource_any(self, SYS_RES_IRQ, &rid,
+	    RF_SHAREABLE | RF_ACTIVE);
+	if (sc->irq_res == NULL) {
+		device_printf(self, "Could not allocate irq\n");
+		ehci_mbus_detach(self);
+		return (ENXIO);
+	}
+	sc->sc_bus.bdev = device_add_child(self, "usb", -1);
+	if (!sc->sc_bus.bdev) {
+		device_printf(self, "Could not add USB device\n");
+		ehci_mbus_detach(self);
+		return (ENOMEM);
+	}
+	device_set_ivars(sc->sc_bus.bdev, &sc->sc_bus);
+
+	sprintf(sc->sc_vendor, "Marvell");
+	sc->sc_id_vendor = EHCI_VENDORID_MRVL;
+
+	err = bus_setup_intr(self, sc->irq_res, INTR_TYPE_BIO,
+	    NULL, (driver_intr_t*)ehci_intr, sc, &sc->ih);
+	if (err) {
+		device_printf(self, "Could not setup irq, %d\n", err);
+		sc->ih = NULL;
+		ehci_mbus_detach(self);
+		return (ENXIO);
+	}
+
+	/* There are no companion USB controllers */
+	sc->sc_ncomp = 0;
+
+	/* Allocate a parent dma tag for DMA maps */
+	err = bus_dma_tag_create(bus_get_dma_tag(self), 1, 0,
+	    BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
+	    BUS_SPACE_MAXSIZE_32BIT, USB_DMA_NSEG, BUS_SPACE_MAXSIZE_32BIT, 0,
+	    NULL, NULL, &sc->sc_bus.parent_dmatag);
+	if (err) {
+		device_printf(self, "Could not allocate parent DMA tag (%d)\n",
+		    err);
+		ehci_mbus_detach(self);
+		return (ENXIO);
+	}
+
+	/* Allocate a dma tag for transfer buffers */
+	err = bus_dma_tag_create(sc->sc_bus.parent_dmatag, 1, 0,
+	    BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
+	    BUS_SPACE_MAXSIZE_32BIT, USB_DMA_NSEG, BUS_SPACE_MAXSIZE_32BIT, 0,
+	    busdma_lock_mutex, &Giant, &sc->sc_bus.buffer_dmatag);
+	if (err) {
+		device_printf(self, "Could not allocate buffer DMA tag (%d)\n",
+		    err);
+		ehci_mbus_detach(self);
+		return (ENXIO);
+	}
+
+	/*
+	 * Workaround for Marvell integrated EHCI controller: reset of
+	 * the EHCI core clears the USBMODE register, which sets the core in
+	 * an undefined state (neither host nor agent), so it needs to be set
+	 * again for proper operation.
+	 *
+	 * Refer to errata document MV-S500832-00D.pdf (p. 5.24 GL USB-2) for
+	 * details.
+	 */
+	sc->sc_flags |= EHCI_SCFLG_SETMODE;
+	if (bootverbose)
+		device_printf(self, "5.24 GL USB-2 workaround enabled\n");
+
+	/* XXX all MV chips need it? */
+	sc->sc_flags |= EHCI_SCFLG_FORCESPEED | EHCI_SCFLG_NORESTERM;
+
+	err = ehci_init(sc);
+	if (!err) {
+		sc->sc_flags |= EHCI_SCFLG_DONEINIT;
+		err = device_probe_and_attach(sc->sc_bus.bdev);
+	}
+
+	if (err) {
+		device_printf(self, "USB init failed err=%d\n", err);
+		ehci_mbus_detach(self);
+		return (EIO);
+	}
+	return (0);
+}
+
+static int
+ehci_mbus_detach(device_t self)
+{
+	ehci_softc_t *sc;
+	int err;
+
+	sc = device_get_softc(self);
+	if (sc->sc_flags & EHCI_SCFLG_DONEINIT) {
+		ehci_detach(sc, 0);
+		sc->sc_flags &= ~EHCI_SCFLG_DONEINIT;
+	}
+
+	/*
+	 * Disable interrupts that might have been switched on in ehci_init()
+	 */
+	if (sc->iot && sc->ioh)
+		bus_space_write_4(sc->iot, sc->ioh, EHCI_USBINTR, 0);
+	if (sc->sc_bus.parent_dmatag != NULL)
+		bus_dma_tag_destroy(sc->sc_bus.parent_dmatag);
+	if (sc->sc_bus.buffer_dmatag != NULL)
+		bus_dma_tag_destroy(sc->sc_bus.buffer_dmatag);
+
+	if (sc->irq_res && sc->ih) {
+		err = bus_teardown_intr(self, sc->irq_res, sc->ih);
+
+		if (err)
+			device_printf(self, "Could not tear down irq, %d\n",
+			    err);
+		sc->ih = NULL;
+	}
+	if (sc->sc_bus.bdev) {
+		device_delete_child(self, sc->sc_bus.bdev);
+		sc->sc_bus.bdev = NULL;
+	}
+	if (sc->irq_res) {
+		bus_release_resource(self, SYS_RES_IRQ, 0, sc->irq_res);
+		sc->irq_res = NULL;
+	}
+	if (sc->io_res) {
+		bus_release_resource(self, SYS_RES_MEMORY, 0, sc->io_res);
+		sc->io_res = NULL;
+		sc->iot = 0;
+		sc->ioh = 0;
+	}
+	return (0);
+}
+
+static device_method_t ehci_methods[] = {
+	/* Device interface */
+	DEVMETHOD(device_probe, ehci_mbus_probe),
+	DEVMETHOD(device_attach, ehci_mbus_attach),
+	DEVMETHOD(device_detach, ehci_mbus_detach),
+	DEVMETHOD(device_suspend, ehci_mbus_suspend),
+	DEVMETHOD(device_resume, ehci_mbus_resume),
+	DEVMETHOD(device_shutdown, ehci_mbus_shutdown),
+
+	/* Bus interface */
+	DEVMETHOD(bus_print_child, bus_generic_print_child),
+
+	{0, 0}
+};
+
+static driver_t ehci_driver = {
+	"ehci",
+	ehci_methods,
+	sizeof(ehci_softc_t),
+};
+
+static devclass_t ehci_devclass;
+
+DRIVER_MODULE(ehci, mbus, ehci_driver, ehci_devclass, 0, 0);

Modified: head/sys/dev/usb/ehcivar.h
==============================================================================
--- head/sys/dev/usb/ehcivar.h	Tue Oct 14 04:09:33 2008	(r183865)
+++ head/sys/dev/usb/ehcivar.h	Tue Oct 14 07:05:20 2008	(r183866)
@@ -122,6 +122,9 @@ struct ehci_soft_islot {
 
 #define EHCI_SCFLG_DONEINIT	0x0001	/* ehci_init() has been called. */
 #define EHCI_SCFLG_LOSTINTRBUG	0x0002	/* workaround for VIA / ATI chipsets */
+#define EHCI_SCFLG_SETMODE	0x0004	/* set bridge mode again after init (Marvell) */
+#define EHCI_SCFLG_FORCESPEED	0x0008	/* force speed (Marvell) */
+#define EHCI_SCFLG_NORESTERM	0x0010	/* don't terminate reset sequence (Marvell) */
 
 typedef struct ehci_softc {
 	struct usbd_bus sc_bus;		/* base device */

From owner-svn-src-head@FreeBSD.ORG  Tue Oct 14 07:24:19 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1AB0D1065697;
	Tue, 14 Oct 2008 07:24:19 +0000 (UTC) (envelope-from raj@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 07B228FC13;
	Tue, 14 Oct 2008 07:24:19 +0000 (UTC) (envelope-from raj@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9E7OJ0e098675;
	Tue, 14 Oct 2008 07:24:19 GMT (envelope-from raj@svn.freebsd.org)
Received: (from raj@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9E7OJGX098673;
	Tue, 14 Oct 2008 07:24:19 GMT (envelope-from raj@svn.freebsd.org)
Message-Id: <200810140724.m9E7OJGX098673@svn.freebsd.org>
From: Rafal Jaworowski 
Date: Tue, 14 Oct 2008 07:24:19 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183867 - head/sys/dev/mge
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 14 Oct 2008 07:24:19 -0000

Author: raj
Date: Tue Oct 14 07:24:18 2008
New Revision: 183867
URL: http://svn.freebsd.org/changeset/base/183867

Log:
  Marvell Gigabit Ethernet controller driver.
  
  This supports 1Gbps Ethernet engine found on ARM-based SOCs (Orion, Kirkwood,
  Discovery), as well as on system controllers for PowerPC processors (MV64430,
  MV6446x).
  
  The following advanced features are supported:
  
    - multicast
    - VLAN tagging
    - IP/TCP/UDP checksum calculation offloading
    - polling
    - interrupt coalescing
  
  Obtained from:	Marvell, Semihalf

Added:
  head/sys/dev/mge/
  head/sys/dev/mge/if_mge.c   (contents, props changed)
  head/sys/dev/mge/if_mgevar.h   (contents, props changed)

Added: head/sys/dev/mge/if_mge.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/dev/mge/if_mge.c	Tue Oct 14 07:24:18 2008	(r183867)
@@ -0,0 +1,1757 @@
+/*-
+ * Copyright (C) 2008 MARVELL INTERNATIONAL LTD.
+ * All rights reserved.
+ *
+ * Developed by Semihalf.
+ *
+ * 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.
+ * 3. Neither the name of MARVELL nor the names of contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY 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 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.
+ */
+
+#ifdef HAVE_KERNEL_OPTION_HEADERS
+#include "opt_device_polling.h"
+#endif
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#if defined(SOC_MV_KIRKWOOD) || defined(SOC_MV_DISCOVERY)
+#define  MGE_VER2	1
+#endif
+
+#define	MV_PHY_ADDR_BASE	8
+
+#include 
+#include 
+
+#include "miibus_if.h"
+
+/* PHY registers are in the address space of the first mge unit */
+static struct mge_softc *sc_mge0 = NULL;
+
+static int mge_probe(device_t dev);
+static int mge_attach(device_t dev);
+static int mge_detach(device_t dev);
+static int mge_shutdown(device_t dev);
+static int mge_suspend(device_t dev);
+static int mge_resume(device_t dev);
+
+static int mge_miibus_readreg(device_t dev, int phy, int reg);
+static void mge_miibus_writereg(device_t dev, int phy, int reg, int value);
+
+static int mge_ifmedia_upd(struct ifnet *ifp);
+static void mge_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr);
+
+static void mge_init(void *arg);
+static void mge_init_locked(void *arg);
+static void mge_start(struct ifnet *ifp);
+static void mge_start_locked(struct ifnet *ifp);
+static void mge_watchdog(struct mge_softc *sc);
+static int mge_ioctl(struct ifnet *ifp, u_long command, caddr_t data);
+
+static void mge_intrs_ctrl(struct mge_softc *sc, int enable);
+static void mge_intr_rx(void *arg);
+static void mge_intr_rx_locked(struct mge_softc *sc, int count);
+static void mge_intr_tx(void *arg);
+static void mge_intr_tx_locked(struct mge_softc *sc);
+static void mge_intr_misc(void *arg);
+static void mge_intr_sum(void *arg);
+static void mge_intr_err(void *arg);
+static void mge_stop(struct mge_softc *sc);
+static void mge_tick(void *msc);
+static uint32_t mge_set_port_serial_control(uint32_t media);
+static void mge_get_mac_address(struct mge_softc *sc, uint8_t *addr);
+static void mge_set_mac_address(struct mge_softc *sc);
+static void mge_set_ucast_address(struct mge_softc *sc, uint8_t last_byte,
+    uint8_t queue);
+static void mge_set_prom_mode(struct mge_softc *sc, uint8_t queue);
+static int mge_allocate_dma(struct mge_softc *sc);
+static int mge_alloc_desc_dma(struct mge_softc *sc,
+    struct mge_desc_wrapper* desc_tab, uint32_t size, bus_dma_tag_t *buffer_tag);
+static int mge_new_rxbuf(bus_dma_tag_t tag, bus_dmamap_t map,
+    struct mbuf **mbufp, bus_addr_t *paddr);
+static void mge_get_dma_addr(void *arg, bus_dma_segment_t *segs, int nseg, int error);
+static void mge_free_dma(struct mge_softc *sc);
+static void mge_free_desc(struct mge_softc *sc, struct mge_desc_wrapper* tab, uint32_t size,
+    bus_dma_tag_t buffer_tag, uint8_t free_mbufs);
+static void mge_offload_process_frame(struct ifnet *ifp, struct mbuf *frame,
+    uint32_t status, uint16_t bufsize);
+static void mge_offload_setup_descriptor(struct mge_softc *sc,
+    struct mge_desc_wrapper *dw);
+static uint8_t mge_crc8(uint8_t *data, int size);
+static void mge_setup_multicast(struct mge_softc *sc);
+static void mge_set_rxic(struct mge_softc *sc);
+static void mge_set_txic(struct mge_softc *sc);
+static void mge_add_sysctls(struct mge_softc *sc);
+static int mge_sysctl_ic(SYSCTL_HANDLER_ARGS);
+
+static device_method_t mge_methods[] = {
+	/* Device interface */
+	DEVMETHOD(device_probe,		mge_probe),
+	DEVMETHOD(device_attach,	mge_attach),
+	DEVMETHOD(device_detach,	mge_detach),
+	DEVMETHOD(device_shutdown,	mge_shutdown),
+	DEVMETHOD(device_suspend,	mge_suspend),
+	DEVMETHOD(device_resume,	mge_resume),
+	/* MII interface */
+	DEVMETHOD(miibus_readreg,	mge_miibus_readreg),
+	DEVMETHOD(miibus_writereg,	mge_miibus_writereg),
+	{ 0, 0 }
+};
+
+static driver_t mge_driver = {
+	"mge",
+	mge_methods,
+	sizeof(struct mge_softc),
+};
+
+static devclass_t mge_devclass;
+
+DRIVER_MODULE(mge, mbus, mge_driver, mge_devclass, 0, 0);
+DRIVER_MODULE(miibus, mge, miibus_driver, miibus_devclass, 0, 0);
+MODULE_DEPEND(mge, ether, 1, 1, 1);
+MODULE_DEPEND(mge, miibus, 1, 1, 1);
+
+static struct resource_spec res_spec[] = {
+	{ SYS_RES_MEMORY, 0, RF_ACTIVE },
+	{ SYS_RES_IRQ, 0, RF_ACTIVE | RF_SHAREABLE },
+	{ SYS_RES_IRQ, 1, RF_ACTIVE | RF_SHAREABLE },
+	{ SYS_RES_IRQ, 2, RF_ACTIVE | RF_SHAREABLE },
+	{ SYS_RES_IRQ, 3, RF_ACTIVE | RF_SHAREABLE },
+	{ SYS_RES_IRQ, 4, RF_ACTIVE | RF_SHAREABLE },
+	{ -1, 0 }
+};
+
+static struct {
+	driver_intr_t *handler;
+	char * description;
+} mge_intrs[MGE_INTR_COUNT] = {
+	{ mge_intr_rx,	"GbE receive interrupt" },
+	{ mge_intr_tx,	"GbE transmit interrupt" },
+	{ mge_intr_misc,"GbE misc interrupt" },
+	{ mge_intr_sum,	"GbE summary interrupt" },
+	{ mge_intr_err,	"GbE error interrupt" },
+};
+
+static void
+mge_get_mac_address(struct mge_softc *sc, uint8_t *addr)
+{
+	uint32_t mac_l, mac_h;
+
+	/* XXX use currently programmed MAC address; eventually this info will
+	 * be provided by the loader */
+
+	mac_l = MGE_READ(sc, MGE_MAC_ADDR_L);
+	mac_h = MGE_READ(sc, MGE_MAC_ADDR_H);
+
+	addr[0] = (mac_h & 0xff000000) >> 24;
+	addr[1] = (mac_h & 0x00ff0000) >> 16;
+	addr[2] = (mac_h & 0x0000ff00) >> 8;
+	addr[3] = (mac_h & 0x000000ff);
+	addr[4] = (mac_l & 0x0000ff00) >> 8;
+	addr[5] = (mac_l & 0x000000ff);
+}
+
+static void
+mge_set_mac_address(struct mge_softc *sc)
+{
+	char *if_mac;
+	uint32_t mac_l, mac_h;
+
+	MGE_GLOBAL_LOCK_ASSERT(sc);
+
+	if_mac = (char *)IF_LLADDR(sc->ifp);
+
+	mac_l = (if_mac[4] << 8) | (if_mac[5]);
+	mac_h = (if_mac[0] << 24)| (if_mac[1] << 16) |
+	    (if_mac[2] << 8) | (if_mac[3] << 0);
+
+	MGE_WRITE(sc, MGE_MAC_ADDR_L, mac_l);
+	MGE_WRITE(sc, MGE_MAC_ADDR_H, mac_h);
+
+	mge_set_ucast_address(sc, if_mac[5], MGE_RX_DEFAULT_QUEUE);
+}
+
+static void
+mge_set_ucast_address(struct mge_softc *sc, uint8_t last_byte, uint8_t queue)
+{
+	uint32_t reg_idx, reg_off, reg_val, i;
+
+	last_byte &= 0xf;
+	reg_idx = last_byte / MGE_UCAST_REG_NUMBER;
+	reg_off = (last_byte % MGE_UCAST_REG_NUMBER) * 8;
+	reg_val = (1 | (queue << 1)) << reg_off;
+
+	for (i = 0; i < MGE_UCAST_REG_NUMBER; i++) {
+		if ( i == reg_idx)
+			MGE_WRITE(sc, MGE_DA_FILTER_UCAST(i), reg_val);
+		else
+			MGE_WRITE(sc, MGE_DA_FILTER_UCAST(i), 0);
+	}
+}
+
+static void
+mge_set_prom_mode(struct mge_softc *sc, uint8_t queue)
+{
+	uint32_t port_config;
+	uint32_t reg_val, i;
+
+	/* Enable or disable promiscuous mode as needed */
+	if (sc->ifp->if_flags & IFF_PROMISC) {
+		port_config = MGE_READ(sc, MGE_PORT_CONFIG);
+		port_config |= PORT_CONFIG_UPM;
+		MGE_WRITE(sc, MGE_PORT_CONFIG, port_config);
+
+		reg_val = ((1 | (queue << 1)) | (1 | (queue << 1)) << 8 |
+		   (1 | (queue << 1)) << 16 | (1 | (queue << 1)) << 24);
+
+		for (i = 0; i < MGE_MCAST_REG_NUMBER; i++) {
+			MGE_WRITE(sc, MGE_DA_FILTER_SPEC_MCAST(i), reg_val);
+			MGE_WRITE(sc, MGE_DA_FILTER_OTH_MCAST(i), reg_val);
+		}
+
+		for (i = 0; i < MGE_UCAST_REG_NUMBER; i++)
+			MGE_WRITE(sc, MGE_DA_FILTER_UCAST(i), reg_val);
+
+	} else {
+		port_config = MGE_READ(sc, MGE_PORT_CONFIG);
+		port_config &= ~PORT_CONFIG_UPM;
+		MGE_WRITE(sc, MGE_PORT_CONFIG, port_config);
+
+		for (i = 0; i < MGE_MCAST_REG_NUMBER; i++) {
+			MGE_WRITE(sc, MGE_DA_FILTER_SPEC_MCAST(i), 0);
+			MGE_WRITE(sc, MGE_DA_FILTER_OTH_MCAST(i), 0);
+		}
+
+		mge_set_mac_address(sc);
+	}
+}
+
+static void
+mge_get_dma_addr(void *arg, bus_dma_segment_t *segs, int nseg, int error)
+{
+	u_int32_t *paddr;
+
+	KASSERT(nseg == 1, ("wrong number of segments, should be 1"));
+	paddr = arg;
+
+	*paddr = segs->ds_addr;
+}
+
+static int
+mge_new_rxbuf(bus_dma_tag_t tag, bus_dmamap_t map, struct mbuf **mbufp,
+    bus_addr_t *paddr)
+{
+	struct mbuf *new_mbuf;
+	bus_dma_segment_t seg[1];
+	int error;
+	int nsegs;
+
+	KASSERT(mbufp != NULL, ("NULL mbuf pointer!"));
+
+	new_mbuf = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR);
+	if (new_mbuf == NULL)
+		return (ENOBUFS);
+	new_mbuf->m_len = new_mbuf->m_pkthdr.len = new_mbuf->m_ext.ext_size;
+
+	if (*mbufp) {
+		bus_dmamap_sync(tag, map, BUS_DMASYNC_POSTREAD);
+		bus_dmamap_unload(tag, map);
+	}
+
+	error = bus_dmamap_load_mbuf_sg(tag, map, new_mbuf, seg, &nsegs,
+	    BUS_DMA_NOWAIT);
+	KASSERT(nsegs == 1, ("Too many segments returned!"));
+	if (nsegs != 1 || error)
+		panic("mge_new_rxbuf(): nsegs(%d), error(%d)", nsegs, error);
+
+	bus_dmamap_sync(tag, map, BUS_DMASYNC_PREREAD);
+
+	(*mbufp) = new_mbuf;
+	(*paddr) = seg->ds_addr;
+	return (0);
+}
+
+static int
+mge_alloc_desc_dma(struct mge_softc *sc, struct mge_desc_wrapper* tab,
+    uint32_t size, bus_dma_tag_t *buffer_tag)
+{
+	struct mge_desc_wrapper *dw;
+	bus_addr_t desc_paddr;
+	int i, error;
+
+	desc_paddr = 0;
+	for (i = size - 1; i >= 0; i--) {
+		dw = &(tab[i]);
+		error = bus_dmamem_alloc(sc->mge_desc_dtag,
+		    (void**)&(dw->mge_desc),
+		    BUS_DMA_NOWAIT | BUS_DMA_ZERO | BUS_DMA_COHERENT,
+		    &(dw->desc_dmap));
+
+		if (error) {
+			if_printf(sc->ifp, "failed to allocate DMA memory\n");
+			dw->mge_desc = NULL;
+			return (ENXIO);
+		}
+
+		error = bus_dmamap_load(sc->mge_desc_dtag, dw->desc_dmap,
+		    dw->mge_desc, sizeof(struct mge_desc), mge_get_dma_addr,
+		    &(dw->mge_desc_paddr), BUS_DMA_NOWAIT);
+
+		if (error) {
+			if_printf(sc->ifp, "can't load descriptor\n");
+			bus_dmamem_free(sc->mge_desc_dtag, dw->mge_desc,
+			    dw->desc_dmap);
+			dw->mge_desc = NULL;
+			return (ENXIO);
+		}
+
+		/* Chain descriptors */
+		dw->mge_desc->next_desc = desc_paddr;
+		desc_paddr = dw->mge_desc_paddr;
+	}
+	tab[size - 1].mge_desc->next_desc = desc_paddr;
+
+	/* Allocate a busdma tag for mbufs. */
+	error = bus_dma_tag_create(NULL,	/* parent */
+	    8, 0,				/* alignment, boundary */
+	    BUS_SPACE_MAXADDR_32BIT,		/* lowaddr */
+	    BUS_SPACE_MAXADDR,			/* highaddr */
+	    NULL, NULL,				/* filtfunc, filtfuncarg */
+	    MCLBYTES, 1,			/* maxsize, nsegments */
+	    MCLBYTES, 0,			/* maxsegsz, flags */
+	    NULL, NULL,				/* lockfunc, lockfuncarg */
+	    buffer_tag);			/* dmat */
+	if (error) {
+		if_printf(sc->ifp, "failed to create busdma tag for mbufs\n");
+		return (ENXIO);
+	}
+
+	/* Create TX busdma maps */
+	for (i = 0; i < size; i++) {
+		dw = &(tab[i]);
+		error = bus_dmamap_create(*buffer_tag, 0, &dw->buffer_dmap);
+		if (error) {
+			if_printf(sc->ifp, "failed to create map for mbuf\n");
+			return (ENXIO);
+		}
+
+		dw->buffer = (struct mbuf*)NULL;
+		dw->mge_desc->buffer = (bus_addr_t)NULL;
+	}
+
+	return (0);
+}
+
+static int
+mge_allocate_dma(struct mge_softc *sc)
+{
+	int error;
+	struct mge_desc_wrapper *dw;
+	int num, i;
+
+
+	num = MGE_TX_DESC_NUM + MGE_RX_DESC_NUM;
+
+	/* Allocate a busdma tag and DMA safe memory for TX/RX descriptors. */
+	error = bus_dma_tag_create(NULL,	/* parent */
+	    16, 0,				/* alignment, boundary */
+	    BUS_SPACE_MAXADDR_32BIT,		/* lowaddr */
+	    BUS_SPACE_MAXADDR,			/* highaddr */
+	    NULL, NULL,				/* filtfunc, filtfuncarg */
+	    sizeof(struct mge_desc), 1,		/* maxsize, nsegments */
+	    sizeof(struct mge_desc), 0,		/* maxsegsz, flags */
+	    NULL, NULL,				/* lockfunc, lockfuncarg */
+	    &sc->mge_desc_dtag);		/* dmat */
+
+
+	mge_alloc_desc_dma(sc, sc->mge_tx_desc, MGE_TX_DESC_NUM,
+	    &sc->mge_tx_dtag);
+	mge_alloc_desc_dma(sc, sc->mge_rx_desc, MGE_RX_DESC_NUM,
+	    &sc->mge_rx_dtag);
+
+	for (i = 0; i < MGE_RX_DESC_NUM; i++) {
+		dw = &(sc->mge_rx_desc[i]);
+		mge_new_rxbuf(sc->mge_rx_dtag, dw->buffer_dmap, &dw->buffer,
+		    &dw->mge_desc->buffer);
+	}
+
+	sc->tx_desc_start = sc->mge_tx_desc[0].mge_desc_paddr;
+	sc->rx_desc_start = sc->mge_rx_desc[0].mge_desc_paddr;
+
+	return (0);
+}
+
+static void
+mge_free_desc(struct mge_softc *sc, struct mge_desc_wrapper* tab,
+    uint32_t size, bus_dma_tag_t buffer_tag, uint8_t free_mbufs)
+{
+	struct mge_desc_wrapper *dw;
+	int i;
+
+	for (i = 0; i < size; i++) {
+		/* Free RX mbuf */
+		dw = &(tab[i]);
+
+		if (dw->buffer_dmap) {
+			if (free_mbufs) {
+				bus_dmamap_sync(buffer_tag, dw->buffer_dmap,
+				    BUS_DMASYNC_POSTREAD);
+				bus_dmamap_unload(buffer_tag, dw->buffer_dmap);
+			}
+			bus_dmamap_destroy(buffer_tag, dw->buffer_dmap);
+			if (free_mbufs)
+				m_freem(dw->buffer);
+		}
+		/* Free RX descriptors */
+		if (dw->desc_dmap) {
+			bus_dmamap_sync(sc->mge_desc_dtag, dw->desc_dmap,
+			    BUS_DMASYNC_POSTREAD);
+			bus_dmamap_unload(sc->mge_desc_dtag, dw->desc_dmap);
+			bus_dmamem_free(sc->mge_desc_dtag, dw->mge_desc,
+			    dw->desc_dmap);
+		}
+	}
+}
+
+static void
+mge_free_dma(struct mge_softc *sc)
+{
+	/* Free desciptors and mbufs */
+	mge_free_desc(sc, sc->mge_rx_desc, MGE_RX_DESC_NUM, sc->mge_rx_dtag, 1);
+	mge_free_desc(sc, sc->mge_tx_desc, MGE_TX_DESC_NUM, sc->mge_tx_dtag, 0);
+
+	/* Destroy mbuf dma tag */
+	bus_dma_tag_destroy(sc->mge_tx_dtag);
+	bus_dma_tag_destroy(sc->mge_rx_dtag);
+	/* Destroy descriptors tag */
+	bus_dma_tag_destroy(sc->mge_desc_dtag);
+}
+
+static void
+mge_reinit_rx(struct mge_softc *sc)
+{
+	struct mge_desc_wrapper *dw;
+	int i;
+
+	MGE_RECEIVE_LOCK(sc);
+
+	mge_free_desc(sc, sc->mge_rx_desc, MGE_RX_DESC_NUM, sc->mge_rx_dtag, 1);
+
+	mge_alloc_desc_dma(sc, sc->mge_rx_desc, MGE_RX_DESC_NUM,
+	    &sc->mge_rx_dtag);
+
+	for (i = 0; i < MGE_RX_DESC_NUM; i++) {
+		dw = &(sc->mge_rx_desc[i]);
+		mge_new_rxbuf(sc->mge_rx_dtag, dw->buffer_dmap, &dw->buffer,
+		&dw->mge_desc->buffer);
+	}
+
+	sc->rx_desc_start = sc->mge_rx_desc[0].mge_desc_paddr;
+	sc->rx_desc_curr = 0;
+
+	MGE_WRITE(sc, MGE_RX_CUR_DESC_PTR(MGE_RX_DEFAULT_QUEUE),
+	    sc->rx_desc_start);
+
+	/* Enable RX queue */
+	MGE_WRITE(sc, MGE_RX_QUEUE_CMD, MGE_ENABLE_RXQ(MGE_RX_DEFAULT_QUEUE));
+
+	MGE_RECEIVE_UNLOCK(sc);
+}
+
+#ifdef DEVICE_POLLING
+static poll_handler_t mge_poll;
+
+static void
+mge_poll(struct ifnet *ifp, enum poll_cmd cmd, int count)
+{
+	struct mge_softc *sc = ifp->if_softc;
+	uint32_t int_cause, int_cause_ext;
+
+	MGE_GLOBAL_LOCK(sc);
+
+	if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) {
+		MGE_GLOBAL_UNLOCK(sc);
+		return;
+	}
+
+	if (cmd == POLL_AND_CHECK_STATUS) {
+		int_cause = MGE_READ(sc, MGE_PORT_INT_CAUSE);
+		int_cause_ext = MGE_READ(sc, MGE_PORT_INT_CAUSE_EXT);
+
+		/* Check for resource error */
+		if (int_cause & MGE_PORT_INT_RXERRQ0)
+			mge_reinit_rx(sc);
+
+		if (int_cause || int_cause_ext) {
+			MGE_WRITE(sc, MGE_PORT_INT_CAUSE, ~int_cause);
+			MGE_WRITE(sc, MGE_PORT_INT_CAUSE_EXT, ~int_cause_ext);
+		}
+	}
+
+	mge_intr_tx_locked(sc);
+	mge_intr_rx_locked(sc, count);
+
+	MGE_GLOBAL_UNLOCK(sc);
+}
+#endif /* DEVICE_POLLING */
+
+static int
+mge_attach(device_t dev)
+{
+	struct mge_softc *sc;
+	struct ifnet *ifp;
+	uint8_t hwaddr[ETHER_ADDR_LEN];
+	int i, error ;
+
+	sc = device_get_softc(dev);
+	sc->dev = dev;
+
+	if (device_get_unit(dev) == 0)
+		sc_mge0 = sc;
+
+	/* Initialize mutexes */
+	mtx_init(&sc->transmit_lock, device_get_nameunit(dev), "mge TX lock", MTX_DEF);
+	mtx_init(&sc->receive_lock, device_get_nameunit(dev), "mge RX lock", MTX_DEF);
+
+	/* Allocate IO and IRQ resources */
+	error = bus_alloc_resources(dev, res_spec, sc->res);
+	if (error) {
+		device_printf(dev, "could not allocate resources\n");
+		mge_detach(dev);
+		return (ENXIO);
+	}
+
+	/* Allocate DMA, buffers, buffer descriptors */
+	error = mge_allocate_dma(sc);
+	if (error) {
+		mge_detach(dev);
+		return (ENXIO);
+	}
+
+	sc->tx_desc_curr = 0;
+	sc->rx_desc_curr = 0;
+	sc->tx_desc_used_idx = 0;
+
+	/* Configure defaults for interrupts coalescing */
+	sc->rx_ic_time = 768;
+	sc->tx_ic_time = 768;
+	mge_add_sysctls(sc);
+
+	/* Allocate network interface */
+	ifp = sc->ifp = if_alloc(IFT_ETHER);
+	if (ifp == NULL) {
+		device_printf(dev, "if_alloc() failed\n");
+		mge_detach(dev);
+		return (ENOMEM);
+	}
+
+	if_initname(ifp, device_get_name(dev), device_get_unit(dev));
+	ifp->if_softc = sc;
+	ifp->if_flags = IFF_SIMPLEX | IFF_MULTICAST | IFF_BROADCAST;
+	ifp->if_capabilities = IFCAP_HWCSUM | IFCAP_VLAN_MTU;
+	ifp->if_capenable = ifp->if_capabilities;
+	ifp->if_hwassist = MGE_CHECKSUM_FEATURES;
+
+#ifdef DEVICE_POLLING
+	/* Advertise that polling is supported */
+	ifp->if_capabilities |= IFCAP_POLLING;
+#endif
+
+	ifp->if_init = mge_init;
+	ifp->if_start = mge_start;
+	ifp->if_ioctl = mge_ioctl;
+
+	ifp->if_snd.ifq_drv_maxlen = MGE_TX_DESC_NUM - 1;
+	IFQ_SET_MAXLEN(&ifp->if_snd, ifp->if_snd.ifq_drv_maxlen);
+	IFQ_SET_READY(&ifp->if_snd);
+
+	mge_get_mac_address(sc, hwaddr);
+	ether_ifattach(ifp, hwaddr);
+	callout_init(&sc->wd_callout, 0);
+
+	/* Probe PHY(s) */
+	error = mii_phy_probe(dev, &sc->miibus, mge_ifmedia_upd, mge_ifmedia_sts);
+	if (error) {
+		device_printf(dev, "MII failed to find PHY\n");
+		if_free(ifp);
+		sc->ifp = NULL;
+		mge_detach(dev);
+		return (error);
+	}
+	sc->mii = device_get_softc(sc->miibus);
+
+	/* Attach interrupt handlers */
+	for (i = 0; i < 2; ++i) {
+		error = bus_setup_intr(dev, sc->res[1 + i],
+		    INTR_TYPE_NET | INTR_MPSAFE, NULL, *mge_intrs[i].handler,
+		    sc, &sc->ih_cookie[i]);
+		if (error) {
+			device_printf(dev, "could not setup %s\n",
+			    mge_intrs[i].description);
+			ether_ifdetach(sc->ifp);
+			return (error);
+		}
+	}
+
+	return (0);
+}
+
+static int
+mge_detach(device_t dev)
+{
+	struct mge_softc *sc;
+	int error,i;
+
+	sc = device_get_softc(dev);
+
+	/* Stop controller and free TX queue */
+	if (sc->ifp)
+		mge_shutdown(dev);
+
+	/* Wait for stopping ticks */
+        callout_drain(&sc->wd_callout);
+
+	/* Stop and release all interrupts */
+	for (i = 0; i < 2; ++i) {
+		error = bus_teardown_intr(dev, sc->res[1 + i], sc->ih_cookie[i]);
+		if (error)
+			device_printf(dev, "could not release %s\n",
+			    mge_intrs[i].description);
+	}
+
+	/* Detach network interface */
+	if (sc->ifp) {
+		ether_ifdetach(sc->ifp);
+		if_free(sc->ifp);
+	}
+
+	/* Free DMA resources */
+	mge_free_dma(sc);
+
+	/* Free IO memory handler */
+	bus_release_resources(dev, res_spec, sc->res);
+
+	/* Destroy mutexes */
+	mtx_destroy(&sc->receive_lock);
+	mtx_destroy(&sc->transmit_lock);
+
+	return (0);
+}
+
+static void
+mge_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
+{
+	struct mge_softc *sc = ifp->if_softc;
+	struct mii_data *mii;
+
+	MGE_TRANSMIT_LOCK(sc);
+
+	mii = sc->mii;
+	mii_pollstat(mii);
+
+	ifmr->ifm_active = mii->mii_media_active;
+	ifmr->ifm_status = mii->mii_media_status;
+
+	MGE_TRANSMIT_UNLOCK(sc);
+}
+
+static uint32_t
+mge_set_port_serial_control(uint32_t media)
+{
+	uint32_t port_config;
+
+	port_config = PORT_SERIAL_RES_BIT9 | PORT_SERIAL_FORCE_LINK_FAIL |
+	    PORT_SERIAL_MRU(PORT_SERIAL_MRU_1552);
+
+	if (IFM_TYPE(media) == IFM_ETHER) {
+		switch(IFM_SUBTYPE(media)) {
+			case IFM_AUTO:
+				break;
+			case IFM_1000_T:
+				port_config  |= (PORT_SERIAL_GMII_SPEED_1000 |
+				    PORT_SERIAL_AUTONEG | PORT_SERIAL_AUTONEG_FC |
+				    PORT_SERIAL_SPEED_AUTONEG);
+				break;
+			case IFM_100_TX:
+				port_config  |= (PORT_SERIAL_MII_SPEED_100 |
+				    PORT_SERIAL_AUTONEG | PORT_SERIAL_AUTONEG_FC |
+				    PORT_SERIAL_SPEED_AUTONEG);
+				break;
+			case IFM_10_T:
+				port_config  |= (PORT_SERIAL_AUTONEG |
+				    PORT_SERIAL_AUTONEG_FC |
+				    PORT_SERIAL_SPEED_AUTONEG);
+				break;
+		}
+		if (media & IFM_FDX)
+			port_config |= PORT_SERIAL_FULL_DUPLEX;
+	}
+	return (port_config);
+}
+
+static int
+mge_ifmedia_upd(struct ifnet *ifp)
+{
+	struct mge_softc *sc = ifp->if_softc;
+
+	if (ifp->if_flags & IFF_UP) {
+		MGE_GLOBAL_LOCK(sc);
+
+		sc->mge_media_status = sc->mii->mii_media.ifm_media;
+		mii_mediachg(sc->mii);
+		mge_init_locked(sc);
+
+		MGE_GLOBAL_UNLOCK(sc);
+	}
+
+	return (0);
+}
+
+static void
+mge_init(void *arg)
+{
+	struct mge_softc *sc = arg;
+
+	MGE_GLOBAL_LOCK(sc);
+
+	mge_init_locked(arg);
+
+	MGE_GLOBAL_UNLOCK(sc);
+}
+
+static void
+mge_init_locked(void *arg)
+{
+	struct mge_softc *sc = arg;
+	struct mge_desc_wrapper *dw;
+	volatile uint32_t reg_val;
+	int i, count;
+
+
+	MGE_GLOBAL_LOCK_ASSERT(sc);
+
+	/* Stop interface */
+	mge_stop(sc);
+
+	/* Disable interrupts */
+	mge_intrs_ctrl(sc, 0);
+
+	/* Set MAC address */
+	mge_set_mac_address(sc);
+
+	/* Setup multicast filters */
+	mge_setup_multicast(sc);
+
+#if defined(MGE_VER2)
+	MGE_WRITE(sc, MGE_PORT_SERIAL_CTRL1, MGE_RGMII_EN);
+	MGE_WRITE(sc, MGE_FIXED_PRIO_CONF, MGE_FIXED_PRIO_EN(0));
+#endif
+	/* Initialize TX queue configuration registers */
+	MGE_WRITE(sc, MGE_TX_TOKEN_COUNT(0), MGE_TX_TOKEN_Q0_DFLT);
+	MGE_WRITE(sc, MGE_TX_TOKEN_CONF(0), MGE_TX_TOKEN_Q0_DFLT);
+	MGE_WRITE(sc, MGE_TX_ARBITER_CONF(0), MGE_TX_ARB_Q0_DFLT);
+
+	for (i = 1; i < 7; i++) {
+		MGE_WRITE(sc, MGE_TX_TOKEN_COUNT(i), MGE_TX_TOKEN_Q1_7_DFLT);
+		MGE_WRITE(sc, MGE_TX_TOKEN_CONF(i), MGE_TX_TOKEN_Q1_7_DFLT);
+		MGE_WRITE(sc, MGE_TX_ARBITER_CONF(i), MGE_TX_ARB_Q1_7_DFLT);
+	}
+
+	/* Set default MTU */
+	MGE_WRITE(sc, MGE_MTU, MGE_MTU_DEFAULT);
+
+	/* Port configuration */
+	MGE_WRITE(sc, MGE_PORT_CONFIG,
+	    PORT_CONFIG_RXCS | PORT_CONFIG_DFLT_RXQ(0) |
+	    PORT_CONFIG_ARO_RXQ(0));
+	MGE_WRITE(sc, MGE_PORT_EXT_CONFIG , 0x0);
+
+	/* Setup port configuration */
+	reg_val = mge_set_port_serial_control(sc->mge_media_status);
+	MGE_WRITE(sc, MGE_PORT_SERIAL_CTRL, reg_val);
+
+	/* Setup SDMA configuration */
+	MGE_WRITE(sc, MGE_SDMA_CONFIG , MGE_SDMA_RX_BYTE_SWAP |
+	    MGE_SDMA_TX_BYTE_SWAP |
+	    MGE_SDMA_RX_BURST_SIZE(MGE_SDMA_BURST_16_WORD) |
+	    MGE_SDMA_TX_BURST_SIZE(MGE_SDMA_BURST_16_WORD));
+
+	MGE_WRITE(sc, MGE_TX_FIFO_URGENT_TRSH, 0x0);
+
+	MGE_WRITE(sc, MGE_TX_CUR_DESC_PTR, sc->tx_desc_start);
+	MGE_WRITE(sc, MGE_RX_CUR_DESC_PTR(MGE_RX_DEFAULT_QUEUE),
+	    sc->rx_desc_start);
+
+	/* Reset descriptor indexes */
+	sc->tx_desc_curr = 0;
+	sc->rx_desc_curr = 0;
+	sc->tx_desc_used_idx = 0;
+
+	/* Enable RX descriptors */
+	for (i = 0; i < MGE_RX_DESC_NUM; i++) {
+		dw = &sc->mge_rx_desc[i];
+		dw->mge_desc->cmd_status = MGE_RX_ENABLE_INT | MGE_DMA_OWNED;
+		dw->mge_desc->buff_size = MCLBYTES;
+		bus_dmamap_sync(sc->mge_desc_dtag, dw->desc_dmap,
+		    BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
+	}
+
+	/* Enable RX queue */
+	MGE_WRITE(sc, MGE_RX_QUEUE_CMD, MGE_ENABLE_RXQ(MGE_RX_DEFAULT_QUEUE));
+
+	/* Enable port */
+	reg_val = MGE_READ(sc, MGE_PORT_SERIAL_CTRL);
+	reg_val |= PORT_SERIAL_ENABLE;
+	MGE_WRITE(sc, MGE_PORT_SERIAL_CTRL, reg_val);
+	count = 0x100000;
+	for (;;) {
+		reg_val = MGE_READ(sc, MGE_PORT_STATUS);
+		if (reg_val & MGE_STATUS_LINKUP)
+			break;
+		DELAY(100);
+		if (--count == 0) {
+			if_printf(sc->ifp, "Timeout on link-up\n");
+			break;
+		}
+	}
+
+	/* Setup interrupts coalescing */
+	mge_set_rxic(sc);
+	mge_set_txic(sc);
+
+	/* Enable interrupts */
+#ifdef DEVICE_POLLING
+        /*
+	 * * ...only if polling is not turned on. Disable interrupts explicitly
+	 * if polling is enabled.
+	 */
+	if (sc->ifp->if_capenable & IFCAP_POLLING)
+		mge_intrs_ctrl(sc, 0);
+	else
+#endif /* DEVICE_POLLING */
+	mge_intrs_ctrl(sc, 1);
+
+	/* Activate network interface */
+	sc->ifp->if_drv_flags |= IFF_DRV_RUNNING;
+	sc->ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
+	sc->wd_timer = 0;
+
+	/* Schedule watchdog timeout */
+	callout_reset(&sc->wd_callout, hz, mge_tick, sc);
+}
+
+static void
+mge_intr_err(void *arg)
+{
+	struct mge_softc *sc = arg;
+	struct ifnet *ifp;
+
+	ifp = sc->ifp;
+	if_printf(ifp, "%s\n", __FUNCTION__);
+}
+
+static void
+mge_intr_misc(void *arg)
+{
+	struct mge_softc *sc = arg;
+	struct ifnet *ifp;
+
+	ifp = sc->ifp;
+	if_printf(ifp, "%s\n", __FUNCTION__);
+}
+
+static void
+mge_intr_rx(void *arg) {
+	struct mge_softc *sc = arg;
+	uint32_t int_cause, int_cause_ext;
+
+	MGE_RECEIVE_LOCK(sc);
+
+#ifdef DEVICE_POLLING
+	if (sc->ifp->if_capenable & IFCAP_POLLING) {
+		MGE_RECEIVE_UNLOCK(sc);
+		return;
+	}
+#endif
+
+	/* Get interrupt cause */
+	int_cause = MGE_READ(sc, MGE_PORT_INT_CAUSE);
+	int_cause_ext = MGE_READ(sc, MGE_PORT_INT_CAUSE_EXT);
+
+	/* Check for resource error */
+	if (int_cause & MGE_PORT_INT_RXERRQ0) {
+		mge_reinit_rx(sc);
+		MGE_WRITE(sc, MGE_PORT_INT_CAUSE,
+		    int_cause & ~MGE_PORT_INT_RXERRQ0);
+	}
+
+	int_cause &= MGE_PORT_INT_RXQ0;
+	int_cause_ext &= MGE_PORT_INT_EXT_RXOR;
+
+	if (int_cause || int_cause_ext) {
+		MGE_WRITE(sc, MGE_PORT_INT_CAUSE, ~int_cause);
+		MGE_WRITE(sc, MGE_PORT_INT_CAUSE_EXT, ~int_cause_ext);
+		mge_intr_rx_locked(sc, -1);
+	}
+
+	MGE_RECEIVE_UNLOCK(sc);
+}
+
+
+static void
+mge_intr_rx_locked(struct mge_softc *sc, int count)
+{
+	struct ifnet *ifp = sc->ifp;
+	uint32_t status;
+	uint16_t bufsize;
+	struct mge_desc_wrapper* dw;
+	struct mbuf *mb;
+
+	MGE_RECEIVE_LOCK_ASSERT(sc);
+
+	while(count != 0) {
+		dw = &sc->mge_rx_desc[sc->rx_desc_curr];
+		bus_dmamap_sync(sc->mge_desc_dtag, dw->desc_dmap,
+		    BUS_DMASYNC_POSTREAD);
+
+		/* Get status */
+		status = dw->mge_desc->cmd_status;
+		bufsize = dw->mge_desc->buff_size;
+		if ((status & MGE_DMA_OWNED) != 0)
+			break;
+
+		sc->rx_desc_curr = (++sc->rx_desc_curr % MGE_RX_DESC_NUM);
+		if (dw->mge_desc->byte_count &&
+		    ~(status & MGE_ERR_SUMMARY)) {
+
+			bus_dmamap_sync(sc->mge_rx_dtag, dw->buffer_dmap,
+			    BUS_DMASYNC_POSTREAD);
+
+			mb = m_devget(dw->buffer->m_data,
+			    dw->mge_desc->byte_count - ETHER_CRC_LEN,
+			    0, ifp, NULL);
+
+			mb->m_len -= 2;
+			mb->m_pkthdr.len -= 2;
+			mb->m_data += 2;
+
+			mge_offload_process_frame(ifp, mb, status,
+			    bufsize);
+
+			MGE_RECEIVE_UNLOCK(sc);
+			(*ifp->if_input)(ifp, mb);

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-head@FreeBSD.ORG  Tue Oct 14 07:45:11 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 79D7A1065698;
	Tue, 14 Oct 2008 07:45:11 +0000 (UTC)
	(envelope-from n_hibma@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 67BA48FC21;
	Tue, 14 Oct 2008 07:45:11 +0000 (UTC)
	(envelope-from n_hibma@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9E7jB4b099069;
	Tue, 14 Oct 2008 07:45:11 GMT (envelope-from n_hibma@svn.freebsd.org)
Received: (from n_hibma@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9E7jBai099067;
	Tue, 14 Oct 2008 07:45:11 GMT (envelope-from n_hibma@svn.freebsd.org)
Message-Id: <200810140745.m9E7jBai099067@svn.freebsd.org>
From: Nick Hibma 
Date: Tue, 14 Oct 2008 07:45:11 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183868 - head/sys/dev/usb
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 14 Oct 2008 07:45:11 -0000

Author: n_hibma
Date: Tue Oct 14 07:45:11 2008
New Revision: 183868
URL: http://svn.freebsd.org/changeset/base/183868

Log:
  - Fix the naming of the MC950D device.
  - Remove the (unimplemented) U3GFL_EJECT quirk as this won't be implemented in
    the u3g driver anyway (most probably as an entry in devd.conf)

Modified:
  head/sys/dev/usb/u3g.c
  head/sys/dev/usb/usbdevs

Modified: head/sys/dev/usb/u3g.c
==============================================================================
--- head/sys/dev/usb/u3g.c	Tue Oct 14 07:24:18 2008	(r183867)
+++ head/sys/dev/usb/u3g.c	Tue Oct 14 07:45:11 2008	(r183868)
@@ -90,7 +90,6 @@ struct u3g_dev_type_s {
 	u_int16_t		u3g_flags;
 #define U3GFL_NONE		0x0000
 #define U3GFL_HUAWEI_INIT	0x0001		/* Send USB command to reset iface to ucom mode */
-#define U3GFL_EJECT		0x0002		/* Send SCSI eject to reset first iface to ucom mode */
 };
 
 static const struct u3g_dev_type_s u3g_devs[] = {
@@ -108,17 +107,17 @@ static const struct u3g_dev_type_s u3g_d
 	/* OEM: Novatel */
 	{{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_CDMA_MODEM },	U3GFL_NONE },
 	{{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_ES620 },		U3GFL_NONE },
+	{{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_MC950D },		U3GFL_NONE },
 	{{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_U720 },		U3GFL_NONE },
 	{{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_U727 },		U3GFL_NONE },
 	{{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_U740 },		U3GFL_NONE },
 	{{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_U740_2 },		U3GFL_NONE },
-	{{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_U950D },		U3GFL_EJECT },
+	{{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_U870 },		U3GFL_NONE },
 	{{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_V620 },		U3GFL_NONE },
 	{{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_V640 },		U3GFL_NONE },
 	{{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_V720 },		U3GFL_NONE },
 	{{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_V740 },		U3GFL_NONE },
 	{{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_X950D },		U3GFL_NONE },
-	{{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_U870 },		U3GFL_NONE },
 	{{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_XU870 },		U3GFL_NONE },
 	{{ USB_VENDOR_DELL,    USB_PRODUCT_DELL_U740 },			U3GFL_NONE },
 };

Modified: head/sys/dev/usb/usbdevs
==============================================================================
--- head/sys/dev/usb/usbdevs	Tue Oct 14 07:24:18 2008	(r183867)
+++ head/sys/dev/usb/usbdevs	Tue Oct 14 07:45:11 2008	(r183868)
@@ -1839,7 +1839,7 @@ product NOVATEL X950D		0x1450	Merlin X95
 product NOVATEL ES620		0x2100	ES620 CDMA
 product NOVATEL U720		0x2110	Merlin U720
 product NOVATEL U727		0x4100	Merlin U727 CDMA
-product NOVATEL U950D		0x4400	Novatel MC950D HSUPA
+product NOVATEL MC950D		0x4400	Novatel MC950D HSUPA
 product NOVATEL ZEROCD		0x5010	Novatel ZeroCD
 product NOVATEL2 FLEXPACKGPS	0x0100	NovAtel FlexPack GPS receiver
 

From owner-svn-src-head@FreeBSD.ORG  Tue Oct 14 07:52:48 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 40BF61065687;
	Tue, 14 Oct 2008 07:52:48 +0000 (UTC)
	(envelope-from n_hibma@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2E9768FC13;
	Tue, 14 Oct 2008 07:52:48 +0000 (UTC)
	(envelope-from n_hibma@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9E7qlOI099219;
	Tue, 14 Oct 2008 07:52:47 GMT (envelope-from n_hibma@svn.freebsd.org)
Received: (from n_hibma@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9E7qlVn099218;
	Tue, 14 Oct 2008 07:52:47 GMT (envelope-from n_hibma@svn.freebsd.org)
Message-Id: <200810140752.m9E7qlVn099218@svn.freebsd.org>
From: Nick Hibma 
Date: Tue, 14 Oct 2008 07:52:47 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183869 - head/sys/dev/usb
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 14 Oct 2008 07:52:48 -0000

Author: n_hibma
Date: Tue Oct 14 07:52:47 2008
New Revision: 183869
URL: http://svn.freebsd.org/changeset/base/183869

Log:
  Fix a comment.
  
  Submitted by:	Nick Mann

Modified:
  head/sys/dev/usb/umass.c

Modified: head/sys/dev/usb/umass.c
==============================================================================
--- head/sys/dev/usb/umass.c	Tue Oct 14 07:45:11 2008	(r183868)
+++ head/sys/dev/usb/umass.c	Tue Oct 14 07:52:47 2008	(r183869)
@@ -1177,17 +1177,16 @@ umass_match_proto(struct umass_softc *sc
 
 	dd = usbd_get_device_descriptor(udev);
 
-	/* These are 3G modes (E220, Mobile, etc.) devices with auto-install
-	 * flash disks for Windows/MacOSX through the first interface.
-	 * We are assuming that these vendors will not produce mass storage
-	 * devices. See the list of supported parts in u3g, if this happens to
-	 * be a mistake in the future.
+	/* These are 3G modem devices (E220, Mobile, etc.) with auto-install
+	 * flash disks for Windows/MacOSX through the first interface. We are
+	 * assuming that these vendors will not produce mass storage devices.
+	 * See the list of supported parts in u3g, if this happens to be a
+	 * mistake in the future.
 	 */
 	if (UGETW(dd->idVendor) == USB_VENDOR_HUAWEI) {
-		/* The interface is reset in the u3g driver
-		 * (u3g_huawei_reinit()). Allow generic attachment to the
-		 * second interface though. Some Huawei devices contain an SD
-		 * card slot.
+		/* The interface is reset in the u3g driver. Allow generic
+		 * attachment to the second interface though. Some Huawei
+		 * devices contain an SD card slot.
 		 */
 		id = usbd_get_interface_descriptor(iface);
 		if (id == NULL || id->bInterfaceNumber == 0)

From owner-svn-src-head@FreeBSD.ORG  Tue Oct 14 07:59:23 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 89184106569B;
	Tue, 14 Oct 2008 07:59:23 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 76AE38FC19;
	Tue, 14 Oct 2008 07:59:23 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9E7xNhO099432;
	Tue, 14 Oct 2008 07:59:23 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9E7xNwX099428;
	Tue, 14 Oct 2008 07:59:23 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <200810140759.m9E7xNwX099428@svn.freebsd.org>
From: Konstantin Belousov 
Date: Tue, 14 Oct 2008 07:59:23 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183871 - in head/sys: amd64/linux32 compat/linux
	i386/linux
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 14 Oct 2008 07:59:23 -0000

Author: kib
Date: Tue Oct 14 07:59:23 2008
New Revision: 183871
URL: http://svn.freebsd.org/changeset/base/183871

Log:
  Make robust futexes work on linux32/amd64. Use PTRIN to read
  user-mode pointers. Change types used in the structures definitions to
  properly-sized architecture-specific types.
  
  Submitted by:	dchagin
  MFC after:	1 week

Modified:
  head/sys/amd64/linux32/linux.h
  head/sys/compat/linux/linux_futex.c
  head/sys/compat/linux/linux_futex.h
  head/sys/i386/linux/linux.h

Modified: head/sys/amd64/linux32/linux.h
==============================================================================
--- head/sys/amd64/linux32/linux.h	Tue Oct 14 07:58:18 2008	(r183870)
+++ head/sys/amd64/linux32/linux.h	Tue Oct 14 07:59:23 2008	(r183871)
@@ -880,4 +880,15 @@ typedef int l_mqd_t;
 	(LINUX_CLONE_VM | LINUX_CLONE_FS | LINUX_CLONE_FILES |	\
 	LINUX_CLONE_SIGHAND | LINUX_CLONE_THREAD)
 
+/* robust futexes */
+struct linux_robust_list {
+	l_uintptr_t			next;
+};
+
+struct linux_robust_list_head {
+	struct linux_robust_list	list;
+	l_ulong				futex_offset;
+	l_uintptr_t			pending_list;
+};
+
 #endif /* !_AMD64_LINUX_H_ */

Modified: head/sys/compat/linux/linux_futex.c
==============================================================================
--- head/sys/compat/linux/linux_futex.c	Tue Oct 14 07:58:18 2008	(r183870)
+++ head/sys/compat/linux/linux_futex.c	Tue Oct 14 07:59:23 2008	(r183871)
@@ -661,17 +661,17 @@ release_futexes(struct proc *p)
 	if (head == NULL)
 		return;
 
-	if (fetch_robust_entry(&entry, &head->list.next, &pi))
+	if (fetch_robust_entry(&entry, PTRIN(&head->list.next), &pi))
 		return;
 
 	if (copyin(&head->futex_offset, &futex_offset, sizeof(l_ulong)))
 		return;
 
-	if (fetch_robust_entry(&pending, &head->pending_list, &pip))
+	if (fetch_robust_entry(&pending, PTRIN(&head->pending_list), &pip))
 		return;
 
 	while (entry != &head->list) {
-		rc = fetch_robust_entry(&next_entry, &entry->next, &next_pi);
+		rc = fetch_robust_entry(&next_entry, PTRIN(&entry->next), &next_pi);
 
 		if (entry != pending)
 			if (handle_futex_death((char *)entry + futex_offset,

Modified: head/sys/compat/linux/linux_futex.h
==============================================================================
--- head/sys/compat/linux/linux_futex.h	Tue Oct 14 07:58:18 2008	(r183870)
+++ head/sys/compat/linux/linux_futex.h	Tue Oct 14 07:59:23 2008	(r183871)
@@ -63,18 +63,6 @@
 #define FUTEX_OP_CMP_GT         4	/* if (oldval > CMPARG) wake */
 #define FUTEX_OP_CMP_GE         5	/* if (oldval >= CMPARG) wake */
 
-/* This is defined by Linux user-space */
-
-struct linux_robust_list {
-	struct linux_robust_list	*next;
-};
-
-struct linux_robust_list_head {
-	struct linux_robust_list	list;
-	l_ulong				futex_offset;
-	struct linux_robust_list	*pending_list;
-};
-
 #define	FUTEX_WAITERS		0x80000000
 #define	FUTEX_OWNER_DIED	0x40000000
 #define	FUTEX_TID_MASK		0x3fffffff

Modified: head/sys/i386/linux/linux.h
==============================================================================
--- head/sys/i386/linux/linux.h	Tue Oct 14 07:58:18 2008	(r183870)
+++ head/sys/i386/linux/linux.h	Tue Oct 14 07:59:23 2008	(r183871)
@@ -845,4 +845,15 @@ typedef int l_mqd_t;
 	(LINUX_CLONE_VM | LINUX_CLONE_FS | LINUX_CLONE_FILES |	\
 	LINUX_CLONE_SIGHAND | LINUX_CLONE_THREAD)
 
+/* robust futexes */
+struct linux_robust_list {
+	struct linux_robust_list	*next;
+};
+
+struct linux_robust_list_head {
+	struct linux_robust_list	list;
+	l_ulong				futex_offset;
+	struct linux_robust_list	*pending_list;
+};
+
 #endif /* !_I386_LINUX_H_ */

From owner-svn-src-head@FreeBSD.ORG  Tue Oct 14 08:18:27 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C963310657B0;
	Tue, 14 Oct 2008 08:18:27 +0000 (UTC) (envelope-from raj@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B73C78FC18;
	Tue, 14 Oct 2008 08:18:27 +0000 (UTC) (envelope-from raj@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9E8IR0C099908;
	Tue, 14 Oct 2008 08:18:27 GMT (envelope-from raj@svn.freebsd.org)
Received: (from raj@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9E8IRLX099905;
	Tue, 14 Oct 2008 08:18:27 GMT (envelope-from raj@svn.freebsd.org)
Message-Id: <200810140818.m9E8IRLX099905@svn.freebsd.org>
From: Rafal Jaworowski 
Date: Tue, 14 Oct 2008 08:18:27 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183873 - head/sys/arm/conf
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 14 Oct 2008 08:18:27 -0000

Author: raj
Date: Tue Oct 14 08:18:27 2008
New Revision: 183873
URL: http://svn.freebsd.org/changeset/base/183873

Log:
  Add kernel config files for Marvell development boards.
  
  FreeBSD 8-CURRENT was tested and run successfully on the following eval
  boards and devices :
  
    * DB-88F5182, DB-88F5281 (Orion based)
  
    * DB-88F6281, RD-88F6281 (Kirkwood based)
  
    * DB-78100 (Discovery based)
  
  For more detailed info on build instructions and other examples please refer
  to http://wiki.freebsd.org/FreeBSDMarvell
  
  Obtained from:	Marvell, Semihalf

Added:
  head/sys/arm/conf/DB-78XXX   (contents, props changed)
  head/sys/arm/conf/DB-88F5XXX   (contents, props changed)
  head/sys/arm/conf/DB-88F6XXX   (contents, props changed)

Added: head/sys/arm/conf/DB-78XXX
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/arm/conf/DB-78XXX	Tue Oct 14 08:18:27 2008	(r183873)
@@ -0,0 +1,78 @@
+#
+# Custom kernel for Marvell DB-78xx boards.
+#
+# $FreeBSD$
+#
+
+machine		arm
+ident		DB-88F78XX
+include		"../mv/discovery/std.db78xxx"
+
+options		SOC_MV_DISCOVERY
+
+#makeoptions	DEBUG=-g		#Build kernel with gdb(1) debug symbols
+makeoptions	WERROR="-Werror"
+
+options 	SCHED_4BSD		#4BSD scheduler
+options 	INET			#InterNETworking
+options 	INET6			#IPv6 communications protocols
+options 	FFS			#Berkeley Fast Filesystem
+options 	NFSCLIENT		#Network Filesystem Client
+options		NFSLOCKD		#Network Lock Manager
+options 	NFS_ROOT		#NFS usable as /, requires NFSCLIENT
+options		BOOTP
+options		BOOTP_NFSROOT
+options		BOOTP_NFSV3
+options		BOOTP_WIRED_TO=mge0
+
+#options		ROOTDEVNAME=\"ufs:/dev/da0a\"
+
+options 	SYSVSHM			#SYSV-style shared memory
+options 	SYSVMSG			#SYSV-style message queues
+options 	SYSVSEM			#SYSV-style semaphores
+options 	_KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions
+options 	MUTEX_NOINLINE
+options		RWLOCK_NOINLINE
+options 	NO_FFS_SNAPSHOT
+options 	NO_SWAPPING
+
+# Debugging
+options		ALT_BREAK_TO_DEBUGGER
+options		DDB
+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_KDB
+
+# Pseudo devices
+device		loop
+device		mem
+device		md
+device		pty
+device		random
+
+# Serial ports
+device		uart
+
+# Networking
+device		ether
+device		mge			# Marvell Gigabit Ethernet controller
+device		mii
+device		e1000phy
+device		bpf
+
+# USB
+device		usb
+device		ehci
+device		umass
+device		scbus
+device		pass
+device		da
+
+# I2C (TWSI)
+device		iic
+device		iicbus
+device		ds133x

Added: head/sys/arm/conf/DB-88F5XXX
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/arm/conf/DB-88F5XXX	Tue Oct 14 08:18:27 2008	(r183873)
@@ -0,0 +1,80 @@
+#
+# Custom kernel for Marvell DB-88F5xxx boards.
+#
+# $FreeBSD$
+#
+
+machine		arm
+ident		DB-88F5XXX
+include		"../mv/orion/std.db88f5xxx"
+
+options		SOC_MV_ORION
+
+#makeoptions	DEBUG=-g		#Build kernel with gdb(1) debug symbols
+makeoptions	WERROR="-Werror"
+
+options 	SCHED_4BSD		#4BSD scheduler
+options 	INET			#InterNETworking
+options 	INET6			#IPv6 communications protocols
+options 	FFS			#Berkeley Fast Filesystem
+options 	NFSCLIENT		#Network Filesystem Client
+options		NFSLOCKD		#Network Lock Manager
+options 	NFS_ROOT		#NFS usable as /, requires NFSCLIENT
+options		BOOTP
+options		BOOTP_NFSROOT
+options		BOOTP_NFSV3
+options		BOOTP_WIRED_TO=mge0
+
+#options		ROOTDEVNAME=\"ufs:/dev/da0a\"
+
+options 	SYSVSHM			#SYSV-style shared memory
+options 	SYSVMSG			#SYSV-style message queues
+options 	SYSVSEM			#SYSV-style semaphores
+options 	_KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions
+options 	MUTEX_NOINLINE
+options		RWLOCK_NOINLINE
+options 	NO_FFS_SNAPSHOT
+options 	NO_SWAPPING
+
+# Debugging
+options		ALT_BREAK_TO_DEBUGGER
+options		DDB
+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_KDB
+
+# Pseudo devices
+device		mem
+device		md
+device		loop
+device		pty
+device		random
+
+# Serial ports
+device		uart
+
+# Networking
+device		ether
+device		mge			# Marvell Gigabit Ethernet controller
+device		mii
+device		e1000phy
+device		bpf
+options		DEVICE_POLLING
+options		HZ=1000
+
+# I2C (TWSI)
+device		iic
+device		iicbus
+device		ds133x
+
+# USB
+device		usb
+device		ehci
+device		umass
+device		scbus
+device		pass
+device		da

Added: head/sys/arm/conf/DB-88F6XXX
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/arm/conf/DB-88F6XXX	Tue Oct 14 08:18:27 2008	(r183873)
@@ -0,0 +1,77 @@
+#
+# Custom kernel for Marvell DB-88F6xxx boards.
+#
+# $FreeBSD$
+#
+
+machine		arm
+ident		DB-88F6XXX
+include		"../mv/kirkwood/std.db88f6xxx"
+
+options		SOC_MV_KIRKWOOD
+
+#makeoptions	DEBUG=-g		#Build kernel with gdb(1) debug symbols
+makeoptions	WERROR="-Werror"
+
+options 	SCHED_4BSD		#4BSD scheduler
+options 	INET			#InterNETworking
+options 	INET6			#IPv6 communications protocols
+options 	FFS			#Berkeley Fast Filesystem
+options 	NFSCLIENT		#Network Filesystem Client
+options		NFSLOCKD		#Network Lock Manager
+options 	NFS_ROOT		#NFS usable as /, requires NFSCLIENT
+options		BOOTP
+options		BOOTP_NFSROOT
+options		BOOTP_NFSV3
+options		BOOTP_WIRED_TO=mge0
+
+#options		ROOTDEVNAME=\"ufs:/dev/da0a\"
+
+options 	SYSVSHM			#SYSV-style shared memory
+options 	SYSVMSG			#SYSV-style message queues
+options 	SYSVSEM			#SYSV-style semaphores
+options 	_KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions
+options 	MUTEX_NOINLINE
+options		RWLOCK_NOINLINE
+options 	NO_FFS_SNAPSHOT
+options 	NO_SWAPPING
+
+# Debugging
+options		ALT_BREAK_TO_DEBUGGER
+options		DDB
+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_KDB
+
+# Pseudo devices
+device		loop
+device		mem
+device		md
+device		pty
+device		random
+
+# Serial ports
+device		uart
+
+# Networking
+device		ether
+device		mge			# Marvell Gigabit Ethernet controller
+device		mii
+device		e1000phy
+device		bpf
+
+# USB
+device		usb
+device		ehci
+device		umass
+device		scbus
+device		pass
+device		da
+
+# I2C (TWSI)
+device		iic
+device		iicbus

From owner-svn-src-head@FreeBSD.ORG  Tue Oct 14 08:41:55 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D2BE81065686;
	Tue, 14 Oct 2008 08:41:55 +0000 (UTC)
	(envelope-from n_hibma@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C00678FC20;
	Tue, 14 Oct 2008 08:41:55 +0000 (UTC)
	(envelope-from n_hibma@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9E8fti9000463;
	Tue, 14 Oct 2008 08:41:55 GMT (envelope-from n_hibma@svn.freebsd.org)
Received: (from n_hibma@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9E8ft6L000461;
	Tue, 14 Oct 2008 08:41:55 GMT (envelope-from n_hibma@svn.freebsd.org)
Message-Id: <200810140841.m9E8ft6L000461@svn.freebsd.org>
From: Nick Hibma 
Date: Tue, 14 Oct 2008 08:41:54 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183874 - head/sys/dev/usb
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 14 Oct 2008 08:41:55 -0000

Author: n_hibma
Date: Tue Oct 14 08:41:54 2008
New Revision: 183874
URL: http://svn.freebsd.org/changeset/base/183874

Log:
  Move all the hacks for the Huawei, Novatel and Qualcomm cards into a stub
  driver.
  
  This stub also hides the devices until they are ready to be used to avoid
  confusion (commented out for now).

Modified:
  head/sys/dev/usb/u3g.c
  head/sys/dev/usb/umass.c

Modified: head/sys/dev/usb/u3g.c
==============================================================================
--- head/sys/dev/usb/u3g.c	Tue Oct 14 08:18:27 2008	(r183873)
+++ head/sys/dev/usb/u3g.c	Tue Oct 14 08:41:54 2008	(r183874)
@@ -94,16 +94,18 @@ struct u3g_dev_type_s {
 
 static const struct u3g_dev_type_s u3g_devs[] = {
 	/* OEM: Option */
-	{{ USB_VENDOR_OPTION, USB_PRODUCT_OPTION_GT3G },		U3GFL_NONE},
-	{{ USB_VENDOR_OPTION, USB_PRODUCT_OPTION_GT3GQUAD },		U3GFL_NONE},
-	{{ USB_VENDOR_OPTION, USB_PRODUCT_OPTION_GT3GPLUS },		U3GFL_NONE},
-	{{ USB_VENDOR_OPTION, USB_PRODUCT_OPTION_GTMAX36 },		U3GFL_NONE},
-	{{ USB_VENDOR_OPTION, USB_PRODUCT_OPTION_VODAFONEMC3G },	U3GFL_NONE},
+	{{ USB_VENDOR_OPTION, USB_PRODUCT_OPTION_GT3G },		U3GFL_NONE },
+	{{ USB_VENDOR_OPTION, USB_PRODUCT_OPTION_GT3GQUAD },		U3GFL_NONE },
+	{{ USB_VENDOR_OPTION, USB_PRODUCT_OPTION_GT3GPLUS },		U3GFL_NONE },
+	{{ USB_VENDOR_OPTION, USB_PRODUCT_OPTION_GTMAX36 },		U3GFL_NONE },
+	{{ USB_VENDOR_OPTION, USB_PRODUCT_OPTION_VODAFONEMC3G },	U3GFL_NONE },
 	/* OEM: Qualcomm, Inc. */
-	{{ USB_VENDOR_QUALCOMMINC, USB_PRODUCT_QUALCOMMINC_CDMA_MSM },	U3GFL_EJECT},
+	{{ USB_VENDOR_QUALCOMMINC, USB_PRODUCT_QUALCOMMINC_CDMA_MSM },	U3GFL_NONE },
 	/* OEM: Huawei */
-	{{ USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_MOBILE },		U3GFL_HUAWEI_INIT},
-	{{ USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_E220 },		U3GFL_HUAWEI_INIT},
+	/* Handled separately. Do not add!
+	{{ USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_MOBILE },		U3GFL_NONE },
+	{{ USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_E220 },		U3GFL_NONE },
+	 */
 	/* OEM: Novatel */
 	{{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_CDMA_MODEM },	U3GFL_NONE },
 	{{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_ES620 },		U3GFL_NONE },
@@ -133,51 +135,31 @@ u3g_intr(usbd_xfer_handle xfer, usbd_pri
 #endif
 
 static int
-u3g_huawei_reinit(usbd_device_handle dev, usbd_interface_handle iface)
-{
-	/* The Huawei device presents itself as a umass device with Windows
-	 * drivers on it. After installation of the driver, it reinits into a
-	 * 3G serial device.
-	 */
-	usb_device_request_t req;
-	usb_interface_descriptor_t *idesc;
-
-	if (iface == NULL)
-		return UMATCH_NONE;
-	idesc = usbd_get_interface_descriptor(iface);
-	if (idesc == NULL)
-		return UMATCH_NONE;
-
-	/* If the interface class is no longer mass storage it has changed
-	 * appearance and we should attach it.
-	 */
-	if (idesc->bInterfaceClass == UICLASS_VENDOR)
-		return (UMATCH_VENDOR_PRODUCT_CONF_IFACE);
-
-	req.bmRequestType = UT_WRITE_DEVICE;
-	req.bRequest = UR_SET_FEATURE;
-	USETW(req.wValue, UF_DEVICE_REMOTE_WAKEUP);
-	USETW(req.wIndex, UHF_PORT_SUSPEND);
-	USETW(req.wLength, 0);
-
-	(void) usbd_do_request(dev, &req, 0);
-
-	return UMATCH_NONE;	/* mismatch; it will be gone and reappear */
-}
-
-static int
 u3g_match(device_t self)
 {
 	struct usb_attach_arg *uaa = device_get_ivars(self);
+	usb_interface_descriptor_t *id;
+	const struct u3g_dev_type_s *u3g_dev_type;
 
-	const struct u3g_dev_type_s *u3g_dev_type = u3g_lookup(uaa->vendor, uaa->product);
-	if (u3g_dev_type) {
-		if (u3g_dev_type->u3g_flags & U3GFL_HUAWEI_INIT)
-			return u3g_huawei_reinit(uaa->device, uaa->iface);
-		else
-			return UMATCH_VENDOR_PRODUCT;
+	if (uaa->vendor == USB_VENDOR_HUAWEI) {
+		if (uaa->iface) {
+			/* We attach to the interface instead of the device as
+			 * some devices have a built-in SD card reader on the
+			 * second interface. If the interface class of the
+			 * first interface is no longer mass storage it has
+			 * changed appearance and we should attach it.
+			 */
+			id = usbd_get_interface_descriptor(uaa->iface);
+			if (id && id->bInterfaceClass == UICLASS_VENDOR)
+				return (UMATCH_VENDOR_PRODUCT_CONF_IFACE);
+		}
+		return UMATCH_NONE;
 	}
 
+	u3g_dev_type = u3g_lookup(uaa->vendor, uaa->product);
+	if (u3g_dev_type)
+		return UMATCH_VENDOR_PRODUCT;
+
 	return UMATCH_NONE;
 }
 
@@ -192,7 +174,7 @@ u3g_attach(device_t self)
 	usb_endpoint_descriptor_t *ed;
 	usbd_status error;
 	int i, n; 
-	usb_config_descriptor_t *cdesc;
+	usb_config_descriptor_t *cd;
 	struct ucom_softc *ucom = NULL;
 	char devnamefmt[32];
 
@@ -210,15 +192,15 @@ u3g_attach(device_t self)
 	}
 
 	/* get the config descriptor */
-	cdesc = usbd_get_config_descriptor(dev);
+	cd = usbd_get_config_descriptor(dev);
 
-	if (cdesc == NULL) {
+	if (cd == NULL) {
 		device_printf(self, "failed to get configuration descriptor\n");
 		goto bad;
 	}
 
 	sc->sc_udev = dev;
-	sc->numports = (cdesc->bNumInterface <= U3G_MAXPORTS)?cdesc->bNumInterface:U3G_MAXPORTS;
+	sc->numports = (cd->bNumInterface <= U3G_MAXPORTS)?cd->bNumInterface:U3G_MAXPORTS;
 	for ( i = 0; i < sc->numports; i++ ) {
 		ucom = &sc->sc_ucom[i];
 
@@ -360,3 +342,91 @@ static driver_t u3g_driver = {
 DRIVER_MODULE(u3g, uhub, u3g_driver, ucom_devclass, usbd_driver_load, 0);
 MODULE_DEPEND(u3g, usb, 1, 1, 1);
 MODULE_DEPEND(u3g, ucom, UCOM_MINVER, UCOM_PREFVER, UCOM_MAXVER);
+
+/*******************************************************************
+ ****** Stub driver to hide devices that need to reinitialise ******
+ *******************************************************************/
+
+static void
+u3gstub_huawei_init(usbd_device_handle dev)
+{
+	usb_device_request_t req;
+
+	req.bmRequestType = UT_WRITE_DEVICE;
+	req.bRequest = UR_SET_FEATURE;
+	USETW(req.wValue, UF_DEVICE_REMOTE_WAKEUP);
+	USETW(req.wIndex, UHF_PORT_SUSPEND);
+	USETW(req.wLength, 0);
+
+	(void) usbd_do_request(dev, &req, 0);		/* ignore any error */
+}
+
+static int
+u3gstub_match(device_t self)
+{
+	struct usb_attach_arg *uaa = device_get_ivars(self);
+	usb_device_descriptor_t *dd = usbd_get_device_descriptor(uaa->device);
+	usb_interface_descriptor_t *id;
+
+	/* These are 3G modem devices (E220, Mobile, etc.) with auto-install
+	 * flash disks for Windows/MacOSX through the first interface.
+	 */
+	if (uaa->vendor == USB_VENDOR_HUAWEI) {
+		/* The Huawei device presents itself as a umass device with
+		 * Windows drivers on it. After installation of the driver, it
+		 * reinits into a 3G serial device.
+		 */
+		if (uaa->iface) {
+			id = usbd_get_interface_descriptor(uaa->iface);
+			if (id && id->bInterfaceNumber == 0 && id->bInterfaceClass == UICLASS_MASS) {
+				u3gstub_huawei_init(uaa->device);
+				return (UMATCH_VENDOR_PRODUCT_CONF_IFACE);
+			}
+		}
+	}
+
+	if (UGETW(dd->idVendor) == USB_VENDOR_QUALCOMMINC
+	    || UGETW(dd->idVendor) == USB_VENDOR_NOVATEL) {
+		/* Device by these vendors will automatically reappear as a
+		 * ucom device if ignored (or if sent an eject command).
+		 */
+		return UMATCH_VENDOR_PRODUCT;
+	}
+
+	return UMATCH_NONE;
+}
+
+static int
+u3gstub_attach(device_t self)
+{
+#if 0
+	if (!bootverbose)
+		device_quiet(self);
+#endif
+
+	return 0;
+}
+
+static int
+u3gstub_detach(device_t self)
+{
+	return 0;
+}
+
+static device_method_t u3gstub_methods[] = {
+	/* Device interface */
+	DEVMETHOD(device_probe, u3gstub_match),
+	DEVMETHOD(device_attach, u3gstub_attach),
+	DEVMETHOD(device_detach, u3gstub_detach),
+
+	{ 0, 0 }
+};
+
+static driver_t u3gstub_driver = {
+	"u3gstub",
+	u3gstub_methods,
+	0
+};
+
+DRIVER_MODULE(u3gstub, uhub, u3gstub_driver, ucom_devclass, usbd_driver_load, 0);
+MODULE_DEPEND(u3gstub, usb, 1, 1, 1);

Modified: head/sys/dev/usb/umass.c
==============================================================================
--- head/sys/dev/usb/umass.c	Tue Oct 14 08:18:27 2008	(r183873)
+++ head/sys/dev/usb/umass.c	Tue Oct 14 08:41:54 2008	(r183874)
@@ -1177,28 +1177,6 @@ umass_match_proto(struct umass_softc *sc
 
 	dd = usbd_get_device_descriptor(udev);
 
-	/* These are 3G modem devices (E220, Mobile, etc.) with auto-install
-	 * flash disks for Windows/MacOSX through the first interface. We are
-	 * assuming that these vendors will not produce mass storage devices.
-	 * See the list of supported parts in u3g, if this happens to be a
-	 * mistake in the future.
-	 */
-	if (UGETW(dd->idVendor) == USB_VENDOR_HUAWEI) {
-		/* The interface is reset in the u3g driver. Allow generic
-		 * attachment to the second interface though. Some Huawei
-		 * devices contain an SD card slot.
-		 */
-		id = usbd_get_interface_descriptor(iface);
-		if (id == NULL || id->bInterfaceNumber == 0)
-			return UMATCH_NONE;
-	} else if (UGETW(dd->idVendor) == USB_VENDOR_QUALCOMMINC
-		   || UGETW(dd->idVendor) == USB_VENDOR_NOVATEL) {
-		/* Device by these vendors will automatically reappear as a
-		 * ucom device if ignored (or if sent an eject command).
-		 */
-		return UMATCH_NONE;
-	}
-
 	/* An entry specifically for Y-E Data devices as they don't fit in the
 	 * device description table.
 	 */

From owner-svn-src-head@FreeBSD.ORG  Tue Oct 14 09:53:48 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1B8281065688;
	Tue, 14 Oct 2008 09:53:48 +0000 (UTC) (envelope-from raj@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 09C828FC15;
	Tue, 14 Oct 2008 09:53:48 +0000 (UTC) (envelope-from raj@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9E9rleS001829;
	Tue, 14 Oct 2008 09:53:47 GMT (envelope-from raj@svn.freebsd.org)
Received: (from raj@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9E9rlPR001827;
	Tue, 14 Oct 2008 09:53:47 GMT (envelope-from raj@svn.freebsd.org)
Message-Id: <200810140953.m9E9rlPR001827@svn.freebsd.org>
From: Rafal Jaworowski 
Date: Tue, 14 Oct 2008 09:53:47 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183876 - in head/lib: libc/arm/gen libstand
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 14 Oct 2008 09:53:48 -0000

Author: raj
Date: Tue Oct 14 09:53:47 2008
New Revision: 183876
URL: http://svn.freebsd.org/changeset/base/183876

Log:
  Let libstand(3) build on ARM.
  
  This is a pre-requisite for loader(8) + U-Boot support library on this arch.

Modified:
  head/lib/libc/arm/gen/_setjmp.S
  head/lib/libstand/Makefile

Modified: head/lib/libc/arm/gen/_setjmp.S
==============================================================================
--- head/lib/libc/arm/gen/_setjmp.S	Tue Oct 14 08:44:27 2008	(r183875)
+++ head/lib/libc/arm/gen/_setjmp.S	Tue Oct 14 09:53:47 2008	(r183876)
@@ -101,6 +101,10 @@ ENTRY(_longjmp)
 
 	/* validation failed, die die die. */
 botch:
+#if !defined(_STANDALONE)
 	bl	PIC_SYM(_C_LABEL(longjmperror), PLT)
 	bl	PIC_SYM(_C_LABEL(abort), PLT)
 	b	. - 8		/* Cannot get here */
+#else
+	b	.
+#endif

Modified: head/lib/libstand/Makefile
==============================================================================
--- head/lib/libstand/Makefile	Tue Oct 14 08:44:27 2008	(r183875)
+++ head/lib/libstand/Makefile	Tue Oct 14 09:53:47 2008	(r183876)
@@ -32,6 +32,9 @@ CFLAGS+=	-msoft-float -D_STANDALONE
 .if ${MACHINE_ARCH} == "amd64"
 CFLAGS+=	-m32 -I.
 .endif
+.if ${MACHINE_ARCH} == "arm"
+CFLAGS+=	-msoft-float -DSOFTFLOAT -D_STANDALONE
+.endif
 
 # standalone components and stuff we have modified locally
 SRCS+=	zutil.h __main.c assert.c bcd.c bswap.c environment.c getopt.c gets.c \
@@ -48,12 +51,17 @@ SRCS+= ntoh.c
 # string functions from libc
 .PATH: ${.CURDIR}/../libc/string
 .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" || \
-	${MACHINE_ARCH} == "sparc64" || ${MACHINE_ARCH} == "amd64"
+	${MACHINE_ARCH} == "sparc64" || ${MACHINE_ARCH} == "amd64" || \
+	${MACHINE_ARCH} == "arm"
 SRCS+=	bcmp.c bcopy.c bzero.c ffs.c index.c memccpy.c memchr.c memcmp.c \
         memcpy.c memmove.c memset.c qdivrem.c rindex.c strcat.c strchr.c \
         strcmp.c strcpy.c strcspn.c strlen.c strncat.c strncmp.c strncpy.c \
 	strpbrk.c strrchr.c strsep.c strspn.c strstr.c strtok.c swab.c
 .endif
+.if ${MACHINE_ARCH} == "arm"
+.PATH: ${.CURDIR}/../libc/arm/gen
+SRCS+= divsi3.S
+.endif
 .if ${MACHINE_ARCH} == "ia64"
 .PATH: ${.CURDIR}/../libc/ia64/string
 SRCS+=	bcmp.c bcopy.S bzero.S ffs.S index.c memccpy.c memchr.c memcmp.c \

From owner-svn-src-head@FreeBSD.ORG  Tue Oct 14 10:11:15 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 854861065686;
	Tue, 14 Oct 2008 10:11:15 +0000 (UTC) (envelope-from raj@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 71C878FC25;
	Tue, 14 Oct 2008 10:11:15 +0000 (UTC) (envelope-from raj@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9EABFlH002291;
	Tue, 14 Oct 2008 10:11:15 GMT (envelope-from raj@svn.freebsd.org)
Received: (from raj@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9EABEJW002276;
	Tue, 14 Oct 2008 10:11:14 GMT (envelope-from raj@svn.freebsd.org)
Message-Id: <200810141011.m9EABEJW002276@svn.freebsd.org>
From: Rafal Jaworowski 
Date: Tue, 14 Oct 2008 10:11:14 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183878 - in head/sys: arm/arm arm/include boot
	boot/arm boot/arm/uboot boot/common boot/ficl boot/uboot/lib
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 14 Oct 2008 10:11:15 -0000

Author: raj
Date: Tue Oct 14 10:11:14 2008
New Revision: 183878
URL: http://svn.freebsd.org/changeset/base/183878

Log:
  Initial support of loader(8) for ARM machines running U-Boot.
  
  This uses the common U-Boot support lib (sys/boot/uboot, already used on
  FreeBSD/powerpc), and assumes the underlying firmware has the modern API for
  stand-alone apps enabled in the config (CONFIG_API).
  
  Only netbooting is supported at the moment.
  
  Obtained from:	Marvell, Semihalf

Added:
  head/sys/arm/include/bootinfo.h   (contents, props changed)
  head/sys/boot/arm/uboot/
  head/sys/boot/arm/uboot/Makefile   (contents, props changed)
  head/sys/boot/arm/uboot/conf.c   (contents, props changed)
  head/sys/boot/arm/uboot/help.uboot   (contents, props changed)
  head/sys/boot/arm/uboot/ldscript.arm   (contents, props changed)
  head/sys/boot/arm/uboot/start.S   (contents, props changed)
  head/sys/boot/arm/uboot/version   (contents, props changed)
Modified:
  head/sys/arm/arm/locore.S
  head/sys/arm/include/metadata.h
  head/sys/boot/Makefile
  head/sys/boot/arm/Makefile
  head/sys/boot/common/Makefile.inc
  head/sys/boot/common/load_elf.c
  head/sys/boot/ficl/Makefile
  head/sys/boot/uboot/lib/glue.c

Modified: head/sys/arm/arm/locore.S
==============================================================================
--- head/sys/arm/arm/locore.S	Tue Oct 14 10:09:32 2008	(r183877)
+++ head/sys/arm/arm/locore.S	Tue Oct 14 10:11:14 2008	(r183878)
@@ -66,6 +66,13 @@ __FBSDID("$FreeBSD$");
 ENTRY_NP(btext)
 
 ASENTRY_NP(_start)
+
+/*
+ * Move metadata ptr to r12 (ip)
+ */
+
+	mov	ip, r0
+
 #if defined (FLASHADDR) && defined(LOADERRAMADDR)
 	/* Check if we're running from flash. */
 	ldr	r7, =FLASHADDR
@@ -170,6 +177,8 @@ mmu_done:
 	ldr	pc, .Lvirt_done
 
 virt_done:
+	mov	r0, ip			/* Load argument: metadata ptr */
+
 	mov	fp, #0			/* trace back starts here */
 	bl	_C_LABEL(initarm)	/* Off we go */
 

Added: head/sys/arm/include/bootinfo.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/arm/include/bootinfo.h	Tue Oct 14 10:11:14 2008	(r183878)
@@ -0,0 +1,72 @@
+/*-
+ * Copyright (C) 2006-2008 Semihalf, Marian Balakowicz 
+ * 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 ``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 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _MACHINE_BOOTINFO_H_
+#define _MACHINE_BOOTINFO_H_
+
+#if !defined(LOCORE)
+
+/* Platform hardware spec, received from loader(8) */
+
+#define BI_VERSION	1
+
+struct bi_mem_region {
+	vm_paddr_t	mem_base;
+	vm_size_t	mem_size;
+};
+
+struct bi_eth_addr {
+	u_int8_t	mac_addr[6];
+	u_int8_t	padding[2];
+};
+
+struct bootinfo {
+	u_int32_t	bi_version;
+	vm_offset_t	bi_bar_base;
+	u_int32_t	bi_cpu_clk;
+	u_int32_t	bi_bus_clk;
+	u_int8_t	bi_mem_reg_no;
+	u_int8_t	bi_eth_addr_no;
+	u_int8_t	padding[2];
+
+	u_int8_t	bi_data[1];
+	/*
+	 * The bi_data container is allocated in run time and has the
+	 * following layout:
+	 *
+	 * - bi_mem_reg_no elements of struct bi_mem_region
+	 * - bi_eth_addr_no elements of struct bi_eth_addr
+	 */
+};
+
+extern struct bootinfo *bootinfo;
+
+struct bi_mem_region *bootinfo_mr(void);
+struct bi_eth_addr *bootinfo_eth(void);
+#endif
+
+#endif /* _MACHINE_BOOTINFO_H_ */

Modified: head/sys/arm/include/metadata.h
==============================================================================
--- head/sys/arm/include/metadata.h	Tue Oct 14 10:09:32 2008	(r183877)
+++ head/sys/arm/include/metadata.h	Tue Oct 14 10:11:14 2008	(r183878)
@@ -29,6 +29,6 @@
 #ifndef _MACHINE_METADATA_H_
 #define	_MACHINE_METADATA_H_
 
-#define	MODINFOMD_SMAP		0x1001
+#define	MODINFOMD_BOOTINFO	0x1001
 
 #endif /* !_MACHINE_METADATA_H_ */

Modified: head/sys/boot/Makefile
==============================================================================
--- head/sys/boot/Makefile	Tue Oct 14 10:09:32 2008	(r183877)
+++ head/sys/boot/Makefile	Tue Oct 14 10:11:14 2008	(r183878)
@@ -22,7 +22,7 @@ SUBDIR+=		ofw
 .endif
 
 # Build U-Boot library.
-.if ${MACHINE_ARCH} == "powerpc"
+.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "arm"
 SUBDIR+=		uboot
 .endif
 

Modified: head/sys/boot/arm/Makefile
==============================================================================
--- head/sys/boot/arm/Makefile	Tue Oct 14 10:09:32 2008	(r183877)
+++ head/sys/boot/arm/Makefile	Tue Oct 14 10:11:14 2008	(r183878)
@@ -1,5 +1,5 @@
 # $FreeBSD$
 
-SUBDIR=
+SUBDIR=		uboot
 
 .include 

Added: head/sys/boot/arm/uboot/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/boot/arm/uboot/Makefile	Tue Oct 14 10:11:14 2008	(r183878)
@@ -0,0 +1,96 @@
+# $FreeBSD$
+
+PROG=		ubldr
+NEWVERSWHAT=	"U-Boot loader" ${MACHINE_ARCH}
+BINDIR?=	/boot
+INSTALLFLAGS=	-b
+NO_MAN=
+WARNS?=		1
+
+# Architecture-specific loader code
+SRCS=		start.S conf.c vers.c
+
+LOADER_DISK_SUPPORT?=	no
+LOADER_UFS_SUPPORT?=	no
+LOADER_CD9660_SUPPORT?=	no
+LOADER_EXT2FS_SUPPORT?=	no
+LOADER_NET_SUPPORT?=	yes
+LOADER_NFS_SUPPORT?=	yes
+LOADER_TFTP_SUPPORT?=	no
+LOADER_GZIP_SUPPORT?=	no
+LOADER_BZIP2_SUPPORT?=	no
+
+.if ${LOADER_DISK_SUPPORT} == "yes"
+CFLAGS+=	-DLOADER_DISK_SUPPORT
+.endif
+.if ${LOADER_UFS_SUPPORT} == "yes"
+CFLAGS+=	-DLOADER_UFS_SUPPORT
+.endif
+.if ${LOADER_CD9660_SUPPORT} == "yes"
+CFLAGS+=	-DLOADER_CD9660_SUPPORT
+.endif
+.if ${LOADER_EXT2FS_SUPPORT} == "yes"
+CFLAGS+=	-DLOADER_EXT2FS_SUPPORT
+.endif
+.if ${LOADER_GZIP_SUPPORT} == "yes"
+CFLAGS+=	-DLOADER_GZIP_SUPPORT
+.endif
+.if ${LOADER_BZIP2_SUPPORT} == "yes"
+CFLAGS+=	-DLOADER_BZIP2_SUPPORT
+.endif
+.if ${LOADER_NET_SUPPORT} == "yes"
+CFLAGS+=	-DLOADER_NET_SUPPORT
+.endif
+.if ${LOADER_NFS_SUPPORT} == "yes"
+CFLAGS+=	-DLOADER_NFS_SUPPORT
+.endif
+.if ${LOADER_TFTP_SUPPORT} == "yes"
+CFLAGS+=	-DLOADER_TFTP_SUPPORT
+.endif
+
+.if !defined(NO_FORTH)
+# Enable BootForth
+BOOT_FORTH=	yes
+CFLAGS+=	-DBOOT_FORTH -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/arm
+LIBFICL=	${.OBJDIR}/../../ficl/libficl.a
+.endif
+
+# Always add MI sources
+.PATH:		${.CURDIR}/../../common
+.include	"${.CURDIR}/../../common/Makefile.inc"
+CFLAGS+=	-I${.CURDIR}/../../common
+CFLAGS+=	-I.
+
+CLEANFILES+=	vers.c ${PROG}.help
+
+CFLAGS+=	-ffreestanding
+
+LDFLAGS=	-nostdlib -static -T ${.CURDIR}/ldscript.arm
+
+# Pull in common loader code
+.PATH:		${.CURDIR}/../../uboot/common
+.include	"${.CURDIR}/../../uboot/common/Makefile.inc"
+CFLAGS+=	-I${.CURDIR}/../../uboot/common
+
+# U-Boot standalone support library
+LIBUBOOT=	${.OBJDIR}/../../uboot/lib/libuboot.a
+CFLAGS+=	-I${.CURDIR}/../../uboot/lib
+CFLAGS+=	-I${.OBJDIR}/../../uboot/lib
+
+# where to get libstand from
+CFLAGS+=	-I${.CURDIR}/../../../../lib/libstand/
+
+DPADD=		${LIBFICL} ${LIBUBOOT} ${LIBSTAND}
+LDADD=		${LIBFICL} ${LIBUBOOT} -lstand
+
+vers.c:	${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
+	sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
+
+${PROG}.help: help.common help.uboot
+	cat ${.ALLSRC} | \
+	    awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}
+
+.PATH: ${.CURDIR}/../../forth
+FILES=	${PROG}.help
+
+.include 

Added: head/sys/boot/arm/uboot/conf.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/boot/arm/uboot/conf.c	Tue Oct 14 10:11:14 2008	(r183878)
@@ -0,0 +1,91 @@
+/*-
+ * Copyright (c) 2008 Semihalf, Rafal Jaworowski
+ * 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$");
+
+#include 
+#include "bootstrap.h"
+#include "libuboot.h"
+
+#if defined(LOADER_NET_SUPPORT)
+#include "dev_net.h"
+#endif
+
+struct devsw *devsw[] = {
+#if defined(LOADER_DISK_SUPPORT) || defined(LOADER_CD9660_SUPPORT)
+	&uboot_disk,
+#endif
+#if defined(LOADER_NET_SUPPORT)
+	&netdev,
+#endif
+	NULL
+};
+
+struct fs_ops *file_system[] = {
+#if defined(LOADER_UFS_SUPPORT)
+	&ufs_fsops,
+#endif
+#if defined(LOADER_CD9660_SUPPORT)
+	&cd9660_fsops,
+#endif
+#if defined(LOADER_EXT2FS_SUPPORT)
+	&ext2fs_fsops,
+#endif
+#if defined(LOADER_NFS_SUPPORT)
+	&nfs_fsops,
+#endif
+#if defined(LOADER_TFTP_SUPPORT)
+	&tftp_fsops,
+#endif
+#if defined(LOADER_GZIP_SUPPORT)
+	&gzipfs_fsops,
+#endif
+#if defined(LOADER_BZIP2_SUPPORT)
+	&bzipfs_fsops,
+#endif
+	NULL
+};
+
+struct netif_driver *netif_drivers[] = {
+#if defined(LOADER_NET_SUPPORT)
+	&uboot_net,
+#endif
+	NULL,
+};
+
+struct file_format *file_formats[] = {
+	&uboot_elf,
+	NULL
+};
+
+extern struct console uboot_console;
+
+struct console *consoles[] = {
+	&uboot_console,
+	NULL
+};

Added: head/sys/boot/arm/uboot/help.uboot
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/boot/arm/uboot/help.uboot	Tue Oct 14 10:11:14 2008	(r183878)
@@ -0,0 +1 @@
+$FreeBSD$

Added: head/sys/boot/arm/uboot/ldscript.arm
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/boot/arm/uboot/ldscript.arm	Tue Oct 14 10:11:14 2008	(r183878)
@@ -0,0 +1,134 @@
+/* $FreeBSD$ */
+
+OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
+OUTPUT_ARCH(arm)
+ENTRY(_start)
+SECTIONS
+{
+  /* Read-only sections, merged into text segment: */
+  . = 0x1000000 + SIZEOF_HEADERS;
+  .interp     : { *(.interp) 	}
+  .hash          : { *(.hash)		}
+  .dynsym        : { *(.dynsym)		}
+  .dynstr        : { *(.dynstr)		}
+  .gnu.version   : { *(.gnu.version)	}
+  .gnu.version_d   : { *(.gnu.version_d)	}
+  .gnu.version_r   : { *(.gnu.version_r)	}
+  .rela.text     :
+    { *(.rela.text) *(.rela.gnu.linkonce.t*) }
+  .rela.data     :
+    { *(.rela.data) *(.rela.gnu.linkonce.d*) }
+  .rela.rodata   :
+    { *(.rela.rodata) *(.rela.gnu.linkonce.r*) }
+  .rela.got      : { *(.rela.got)		}
+  .rela.got1     : { *(.rela.got1)		}
+  .rela.got2     : { *(.rela.got2)		}
+  .rela.ctors    : { *(.rela.ctors)	}
+  .rela.dtors    : { *(.rela.dtors)	}
+  .rela.init     : { *(.rela.init)	}
+  .rela.fini     : { *(.rela.fini)	}
+  .rela.bss      : { *(.rela.bss)		}
+  .rela.plt      : { *(.rela.plt)		}
+  .rela.sdata    : { *(.rela.sdata)		}
+  .rela.sbss     : { *(.rela.sbss)		}
+  .rela.sdata2   : { *(.rela.sdata2)		}
+  .rela.sbss2    : { *(.rela.sbss2)		}
+  .text      :
+  {
+    *(.text)
+    /* .gnu.warning sections are handled specially by elf32.em.  */
+    *(.gnu.warning)
+    *(.gnu.linkonce.t*)
+  } =0
+  _etext = .;
+  PROVIDE (etext = .);
+  .init      : { *(.init)    } =0
+  .fini      : { *(.fini)    } =0
+  .rodata    : { *(.rodata) *(.gnu.linkonce.r*) }
+  .rodata1   : { *(.rodata1) }
+  .sdata2    : { *(.sdata2)  }
+  .sbss2     : { *(.sbss2)   }
+  /* Adjust the address for the data segment to the next page up. */
+  . = ((. + 0x1000) & ~(0x1000 - 1));
+  .data    :
+  {
+    *(.data)
+    *(.gnu.linkonce.d*)
+    CONSTRUCTORS
+  }
+  .data1   : { *(.data1) }
+  .got1           : { *(.got1) }
+  .dynamic        : { *(.dynamic) }
+  /* Put .ctors and .dtors next to the .got2 section, so that the pointers
+     get relocated with -mrelocatable. Also put in the .fixup pointers.
+     The current compiler no longer needs this, but keep it around for 2.7.2  */
+                PROVIDE (_GOT2_START_ = .);
+  .got2           :  { *(.got2) }
+                PROVIDE (__CTOR_LIST__ = .);
+  .ctors          : { *(.ctors) }
+                PROVIDE (__CTOR_END__ = .);
+                PROVIDE (__DTOR_LIST__ = .);
+  .dtors          : { *(.dtors) }
+                PROVIDE (__DTOR_END__ = .);
+                PROVIDE (_FIXUP_START_ = .);
+  .fixup          : { *(.fixup) }
+                PROVIDE (_FIXUP_END_ = .);
+                PROVIDE (_GOT2_END_ = .);
+                PROVIDE (_GOT_START_ = .);
+  .got            : { *(.got) }
+  .got.plt        : { *(.got.plt) }
+                PROVIDE (_GOT_END_ = .);
+  /* We want the small data sections together, so single-instruction offsets
+     can access them all, and initialized data all before uninitialized, so
+     we can shorten the on-disk segment size.  */
+  .sdata     : { *(.sdata) }
+  _edata  =  .;
+  PROVIDE (edata = .);
+  .sbss      :
+  {
+    PROVIDE (__sbss_start = .);
+    *(.sbss)
+    *(.scommon)
+    *(.dynsbss)
+    PROVIDE (__sbss_end = .);
+  }
+  .plt   : { *(.plt) }
+  .bss       :
+  {
+   PROVIDE (__bss_start = .);
+   *(.dynbss)
+   *(.bss)
+   *(COMMON)
+  }
+  _end = . ;
+  PROVIDE (end = .);
+  /* Stabs debugging sections.  */
+  .stab 0 : { *(.stab) }
+  .stabstr 0 : { *(.stabstr) }
+  /* DWARF debug sections.
+     Symbols in the DWARF debugging sections are relative to the beginning
+     of the section so we begin them at 0.  */
+  /* DWARF 1 */
+  .debug          0 : { *(.debug) }
+  .line           0 : { *(.line) }
+  /* GNU DWARF 1 extensions */
+  .debug_srcinfo  0 : { *(.debug_srcinfo) }
+  .debug_sfnames  0 : { *(.debug_sfnames) }
+  /* DWARF 1.1 and DWARF 2 */
+  .debug_aranges  0 : { *(.debug_aranges) }
+  .debug_pubnames 0 : { *(.debug_pubnames) }
+  /* DWARF 2 */
+  .debug_info     0 : { *(.debug_info) }
+  .debug_abbrev   0 : { *(.debug_abbrev) }
+  .debug_line     0 : { *(.debug_line) }
+  .debug_frame    0 : { *(.debug_frame) }
+  .debug_str      0 : { *(.debug_str) }
+  .debug_loc      0 : { *(.debug_loc) }
+  .debug_macinfo  0 : { *(.debug_macinfo) }
+  /* SGI/MIPS DWARF 2 extensions */
+  .debug_weaknames 0 : { *(.debug_weaknames) }
+  .debug_funcnames 0 : { *(.debug_funcnames) }
+  .debug_typenames 0 : { *(.debug_typenames) }
+  .debug_varnames  0 : { *(.debug_varnames) }
+  /* These must appear regardless of  .  */
+}

Added: head/sys/boot/arm/uboot/start.S
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/boot/arm/uboot/start.S	Tue Oct 14 10:11:14 2008	(r183878)
@@ -0,0 +1,93 @@
+/*-
+ * Copyright (c) 2008 Semihalf, Rafal Czubak
+ * 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.
+ *
+ * $FreeBSD$
+ */
+
+#include 
+
+/*
+ * Entry point to the loader that U-Boot passes control to.
+ */
+	.text
+	.globl	_start
+_start:
+	/* Hint where to look for the API signature */
+	ldr	ip, =uboot_address
+	str	sp, [ip]
+
+	/* Save U-Boot's r8 */
+	ldr	ip, =saved_regs
+	str	r8, [ip, #0]
+
+	/* Start loader */
+	b	main
+
+/*
+ * syscall()
+ */
+ENTRY(syscall)
+	/* Save caller's lr */
+	ldr	ip, =saved_regs
+	str	lr, [ip, #4]
+	/* Save loader's r8 */
+	ldr	ip, =saved_regs
+	str	r8, [ip, #8]
+
+	/* Restore U-Boot's r8 */
+	ldr	ip, =saved_regs
+	ldr	r8, [ip, #0]
+	/* Call into U-Boot */
+	ldr	lr, =return_from_syscall
+	ldr	ip, =syscall_ptr
+	ldr	pc, [ip]
+
+return_from_syscall:
+	/* Restore loader's r8 */
+	ldr	ip, =saved_regs
+	ldr	r8, [ip, #8]
+	/* Restore caller's lr */
+	ldr	ip, =saved_regs
+	ldr	lr, [ip, #4]
+	/* Return to caller */
+	mov	pc, lr
+
+/*
+ * Data section
+ */
+	.data
+	.align	4
+	.globl	syscall_ptr
+syscall_ptr:
+	.long	0
+
+	.globl	uboot_address
+uboot_address:
+	.long	0
+
+saved_regs:
+	.long	0	/* U-Boot's r8 */
+	.long	0	/* Loader's r8 */
+	.long	0	/* Loader's lr */

Added: head/sys/boot/arm/uboot/version
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/boot/arm/uboot/version	Tue Oct 14 10:11:14 2008	(r183878)
@@ -0,0 +1,6 @@
+$FreeBSD$
+
+NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE.  The format of this
+file is important.  Make sure the current version number is on line 6.
+
+0.5:	Initial U-Boot/arm version (netbooting only).

Modified: head/sys/boot/common/Makefile.inc
==============================================================================
--- head/sys/boot/common/Makefile.inc	Tue Oct 14 10:09:32 2008	(r183877)
+++ head/sys/boot/common/Makefile.inc	Tue Oct 14 10:11:14 2008	(r183878)
@@ -9,7 +9,7 @@ SRCS+=	load_elf32.c load_elf32_obj.c rel
 SRCS+=	load_elf64.c load_elf64_obj.c reloc_elf64.c
 .elif ${MACHINE} == "pc98"
 SRCS+=	load_elf32.c load_elf32_obj.c reloc_elf32.c
-.elif ${MACHINE_ARCH} == "powerpc"
+.elif ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "arm"
 SRCS+=	load_elf32.c reloc_elf32.c
 .elif ${MACHINE_ARCH} == "sparc64" || ${MACHINE_ARCH} == "ia64"
 SRCS+=	load_elf64.c reloc_elf64.c

Modified: head/sys/boot/common/load_elf.c
==============================================================================
--- head/sys/boot/common/load_elf.c	Tue Oct 14 10:09:32 2008	(r183877)
+++ head/sys/boot/common/load_elf.c	Tue Oct 14 10:11:14 2008	(r183878)
@@ -289,7 +289,16 @@ __elfN(loadimage)(struct preloaded_file 
 #ifdef ELF_VERBOSE
 	    printf("Converted entry 0x%08x\n", ehdr->e_entry);
 #endif
-	} else 
+	} else
+	    off = 0;
+#elif defined(__arm__)
+	if (off & 0xf0000000u) {
+	    off = -(off & 0xf0000000u);
+	    ehdr->e_entry += off;
+#ifdef ELF_VERBOSE
+	    printf("Converted entry 0x%08x\n", ehdr->e_entry);
+#endif
+	} else
 	    off = 0;
 #else
 	off = 0;		/* other archs use direct mapped kernels */

Modified: head/sys/boot/ficl/Makefile
==============================================================================
--- head/sys/boot/ficl/Makefile	Tue Oct 14 10:09:32 2008	(r183877)
+++ head/sys/boot/ficl/Makefile	Tue Oct 14 10:11:14 2008	(r183878)
@@ -14,7 +14,7 @@ CFLAGS+=	-mno-mmx -mno-3dnow -mno-sse -m
 .if ${MACHINE_ARCH} == "i386"
 CFLAGS+=	-mno-sse3
 .endif
-.if ${MACHINE_ARCH} == "powerpc"
+.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "arm"
 CFLAGS+=	-msoft-float
 .endif
 .if ${MACHINE} == "pc98"

Modified: head/sys/boot/uboot/lib/glue.c
==============================================================================
--- head/sys/boot/uboot/lib/glue.c	Tue Oct 14 10:09:32 2008	(r183877)
+++ head/sys/boot/uboot/lib/glue.c	Tue Oct 14 10:11:14 2008	(r183878)
@@ -147,7 +147,7 @@ api_search_sig(struct api_signature **si
 		uboot_address = 255 * 1024 * 1024;
 
 	sp = (void *)(uboot_address & ~0x000fffff);
-	spend = sp + 0x00100000 - API_SIG_MAGLEN;
+	spend = sp + 0x00300000 - API_SIG_MAGLEN;
 	while (sp < spend) {
 		if (!bcmp(sp, API_SIG_MAGIC, API_SIG_MAGLEN)) {
 			*sig = (struct api_signature *)sp;

From owner-svn-src-head@FreeBSD.ORG  Tue Oct 14 12:26:55 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AEFE1106568C;
	Tue, 14 Oct 2008 12:26:55 +0000 (UTC)
	(envelope-from maxim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9DB878FC30;
	Tue, 14 Oct 2008 12:26:55 +0000 (UTC)
	(envelope-from maxim@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9ECQt7X006470;
	Tue, 14 Oct 2008 12:26:55 GMT (envelope-from maxim@svn.freebsd.org)
Received: (from maxim@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9ECQtPW006469;
	Tue, 14 Oct 2008 12:26:55 GMT (envelope-from maxim@svn.freebsd.org)
Message-Id: <200810141226.m9ECQtPW006469@svn.freebsd.org>
From: Maxim Konovalov 
Date: Tue, 14 Oct 2008 12:26:55 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183881 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 14 Oct 2008 12:26:55 -0000

Author: maxim
Date: Tue Oct 14 12:26:55 2008
New Revision: 183881
URL: http://svn.freebsd.org/changeset/base/183881

Log:
  o Reformat ipfw nat get|setsockopt code to look it  more
  style(9) compliant.  No functional changes.

Modified:
  head/sys/netinet/ip_fw2.c

Modified: head/sys/netinet/ip_fw2.c
==============================================================================
--- head/sys/netinet/ip_fw2.c	Tue Oct 14 10:23:11 2008	(r183880)
+++ head/sys/netinet/ip_fw2.c	Tue Oct 14 12:26:55 2008	(r183881)
@@ -4385,49 +4385,52 @@ ipfw_ctl(struct sockopt *sopt)
 		break;
 
 	case IP_FW_NAT_CFG:
-	{
-		if (IPFW_NAT_LOADED)
-			error = ipfw_nat_cfg_ptr(sopt);
-		else {
-			printf("IP_FW_NAT_CFG: ipfw_nat not present, please load it.\n");
-			error = EINVAL;
+		{
+			if (IPFW_NAT_LOADED)
+				error = ipfw_nat_cfg_ptr(sopt);
+			else {
+				printf("IP_FW_NAT_CFG: %s\n",
+				    "ipfw_nat not present, please load it");
+				error = EINVAL;
+			}
 		}
-	}
-	break;
+		break;
 
 	case IP_FW_NAT_DEL:
-	{
-		if (IPFW_NAT_LOADED)
-			error = ipfw_nat_del_ptr(sopt);
-		else {
-			printf("IP_FW_NAT_DEL: ipfw_nat not present, please load it.\n");
-			printf("ipfw_nat not loaded: %d\n", sopt->sopt_name);
-			error = EINVAL;
+		{
+			if (IPFW_NAT_LOADED)
+				error = ipfw_nat_del_ptr(sopt);
+			else {
+				printf("IP_FW_NAT_DEL: %s\n",
+				    "ipfw_nat not present, please load it");
+				error = EINVAL;
+			}
 		}
-	}
-	break;
+		break;
 
 	case IP_FW_NAT_GET_CONFIG:
-	{
-		if (IPFW_NAT_LOADED)
-			error = ipfw_nat_get_cfg_ptr(sopt);
-		else {
-			printf("IP_FW_NAT_GET_CFG: ipfw_nat not present, please load it.\n");
-			error = EINVAL;
+		{
+			if (IPFW_NAT_LOADED)
+				error = ipfw_nat_get_cfg_ptr(sopt);
+			else {
+				printf("IP_FW_NAT_GET_CFG: %s\n",
+				    "ipfw_nat not present, please load it");
+				error = EINVAL;
+			}
 		}
-	}
-	break;
+		break;
 
 	case IP_FW_NAT_GET_LOG:
-	{
-		if (IPFW_NAT_LOADED)
-			error = ipfw_nat_get_log_ptr(sopt);
-		else {
-			printf("IP_FW_NAT_GET_LOG: ipfw_nat not present, please load it.\n");
-			error = EINVAL;
+		{
+			if (IPFW_NAT_LOADED)
+				error = ipfw_nat_get_log_ptr(sopt);
+			else {
+				printf("IP_FW_NAT_GET_LOG: %s\n",
+				    "ipfw_nat not present, please load it");
+				error = EINVAL;
+			}
 		}
-	}
-	break;
+		break;
 
 	default:
 		printf("ipfw: ipfw_ctl invalid option %d\n", sopt->sopt_name);

From owner-svn-src-head@FreeBSD.ORG  Tue Oct 14 14:34:35 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8A77E1065691;
	Tue, 14 Oct 2008 14:34:35 +0000 (UTC) (envelope-from rik@inse.ru)
Received: from mail.inse.ru (mail.inse.ru [144.206.128.1])
	by mx1.freebsd.org (Postfix) with ESMTP id 3EB508FC0A;
	Tue, 14 Oct 2008 14:34:35 +0000 (UTC) (envelope-from rik@inse.ru)
Received: from [127.0.0.1] (www.inse.ru [144.206.128.1])
	by mail.inse.ru (Postfix) with ESMTPSA id 48A2F33C51;
	Tue, 14 Oct 2008 18:16:02 +0400 (MSD)
Message-ID: <48F4A9A5.8020605@inse.ru>
Date: Tue, 14 Oct 2008 18:16:05 +0400
From: Roman Kurakin 
User-Agent: Thunderbird 2.0.0.14 (Windows/20080421)
MIME-Version: 1.0
To: Maxim Konovalov 
References: <200810141226.m9ECQtPW006469@svn.freebsd.org>
In-Reply-To: <200810141226.m9ECQtPW006469@svn.freebsd.org>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r183881 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 14 Oct 2008 14:34:35 -0000

Maxim Konovalov:
> Author: maxim
> Date: Tue Oct 14 12:26:55 2008
> New Revision: 183881
> URL: http://svn.freebsd.org/changeset/base/183881
>
> Log:
>   o Reformat ipfw nat get|setsockopt code to look it  more
>   style(9) compliant.  No functional changes.
>
> Modified:
>   head/sys/netinet/ip_fw2.c
>
> Modified: head/sys/netinet/ip_fw2.c
> ==============================================================================
> --- head/sys/netinet/ip_fw2.c	Tue Oct 14 10:23:11 2008	(r183880)
> +++ head/sys/netinet/ip_fw2.c	Tue Oct 14 12:26:55 2008	(r183881)
> @@ -4385,49 +4385,52 @@ ipfw_ctl(struct sockopt *sopt)
>  		break;
>  
>  	case IP_FW_NAT_CFG:
> -	{
> -		if (IPFW_NAT_LOADED)
> -			error = ipfw_nat_cfg_ptr(sopt);
> -		else {
> -			printf("IP_FW_NAT_CFG: ipfw_nat not present, please load it.\n");
> -			error = EINVAL;
> +		{
> +			if (IPFW_NAT_LOADED)
> +				error = ipfw_nat_cfg_ptr(sopt);
> +			else {
> +				printf("IP_FW_NAT_CFG: %s\n",
> +				    "ipfw_nat not present, please load it");
> +				error = EINVAL;
> +			}
>  		}
>   
IMHO such indention does not add any usefulness, but increases indention 
level that is already very high.
Also I do not see strict contradiction to the style(9), but probably I 
am not reading the most current style(9).

rik


From owner-svn-src-head@FreeBSD.ORG  Tue Oct 14 14:54:15 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B6C6D1065690;
	Tue, 14 Oct 2008 14:54:15 +0000 (UTC)
	(envelope-from nwhitehorn@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A0F068FC1C;
	Tue, 14 Oct 2008 14:54:15 +0000 (UTC)
	(envelope-from nwhitehorn@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9EEsFcN009042;
	Tue, 14 Oct 2008 14:54:15 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Received: (from nwhitehorn@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9EEsE4b009028;
	Tue, 14 Oct 2008 14:54:14 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Message-Id: <200810141454.m9EEsE4b009028@svn.freebsd.org>
From: Nathan Whitehorn 
Date: Tue, 14 Oct 2008 14:54:14 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183882 - in head/sys: conf dev/powermac_nvram
	powerpc/aim powerpc/include powerpc/ofw powerpc/powermac
	powerpc/psim
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 14 Oct 2008 14:54:15 -0000

Author: nwhitehorn
Date: Tue Oct 14 14:54:14 2008
New Revision: 183882
URL: http://svn.freebsd.org/changeset/base/183882

Log:
  Convert PowerPC AIM PCI and nexus busses to standard OFW bus interface. This
  simplifies certain device attachments (Kauai ATA, for instance), and makes
  possible others on new hardware.
  
  On G5 systems, there are several otherwise standard PCI devices
  (Serverworks SATA) that will not allow their interrupt properties to be
  written, so this information must be supplied directly from Open Firmware.
  
  Obtained from:	sparc64

Added:
  head/sys/powerpc/ofw/ofw_pcibus.c   (contents, props changed)
Deleted:
  head/sys/powerpc/include/nexusvar.h
  head/sys/powerpc/ofw/ofw_pci.c
  head/sys/powerpc/ofw/ofw_pci.h
Modified:
  head/sys/conf/files.powerpc
  head/sys/dev/powermac_nvram/powermac_nvram.c
  head/sys/powerpc/aim/nexus.c
  head/sys/powerpc/aim/ofw_machdep.c
  head/sys/powerpc/ofw/ofw_pcib_pci.c
  head/sys/powerpc/ofw/ofw_syscons.c
  head/sys/powerpc/powermac/ata_kauai.c
  head/sys/powerpc/powermac/grackle.c
  head/sys/powerpc/powermac/hrowpic.c
  head/sys/powerpc/powermac/macio.c
  head/sys/powerpc/powermac/openpic_macio.c
  head/sys/powerpc/powermac/uninorth.c
  head/sys/powerpc/powermac/uninorthvar.h
  head/sys/powerpc/psim/iobus.c
  head/sys/powerpc/psim/openpic_iobus.c

Modified: head/sys/conf/files.powerpc
==============================================================================
--- head/sys/conf/files.powerpc	Tue Oct 14 12:26:55 2008	(r183881)
+++ head/sys/conf/files.powerpc	Tue Oct 14 14:54:14 2008	(r183882)
@@ -104,7 +104,7 @@ powerpc/mpc85xx/nexus.c		optional	mpc85x
 powerpc/mpc85xx/ocpbus.c	optional	mpc85xx
 powerpc/mpc85xx/opic.c		optional	mpc85xx
 powerpc/mpc85xx/pci_ocp.c	optional	pci mpc85xx
-powerpc/ofw/ofw_pci.c		optional	pci aim
+powerpc/ofw/ofw_pcibus.c	optional	pci aim
 powerpc/ofw/ofw_pcib_pci.c	optional	pci aim
 powerpc/ofw/ofw_syscons.c	optional	sc aim
 powerpc/powermac/ata_kauai.c	optional	powermac ata

Modified: head/sys/dev/powermac_nvram/powermac_nvram.c
==============================================================================
--- head/sys/dev/powermac_nvram/powermac_nvram.c	Tue Oct 14 12:26:55 2008	(r183881)
+++ head/sys/dev/powermac_nvram/powermac_nvram.c	Tue Oct 14 14:54:14 2008	(r183882)
@@ -35,17 +35,15 @@
 #include 
 
 #include 
-#include 
+#include 
 
 #include 
 #include 
-#include 
 #include 
 #include 
 
 #include 
 
-#include 
 #include 
 
 #include 
@@ -113,10 +111,10 @@ static struct cdevsw powermac_nvram_cdev
 static int
 powermac_nvram_probe(device_t dev)
 {
-	char	*type, *compatible;
+	const char	*type, *compatible;
 
-	type = nexus_get_device_type(dev);
-	compatible = nexus_get_compatible(dev);
+	type = ofw_bus_get_type(dev);
+	compatible = ofw_bus_get_compat(dev);
 
 	if (type == NULL || compatible == NULL)
 		return ENXIO;
@@ -136,7 +134,7 @@ powermac_nvram_attach(device_t dev)
 	u_int32_t reg[2];
 	int gen0, gen1;
 
-	node = nexus_get_node(dev);
+	node = ofw_bus_get_node(dev);
 	sc = device_get_softc(dev);
 
 	if (OF_getprop(node, "reg", reg, sizeof(reg)) < 8)

Modified: head/sys/powerpc/aim/nexus.c
==============================================================================
--- head/sys/powerpc/aim/nexus.c	Tue Oct 14 12:26:55 2008	(r183881)
+++ head/sys/powerpc/aim/nexus.c	Tue Oct 14 14:54:14 2008	(r183882)
@@ -70,7 +70,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include 
@@ -90,6 +89,13 @@
 
 static MALLOC_DEFINE(M_NEXUS, "nexus", "nexus device information");
 
+enum nexus_ivars {
+	NEXUS_IVAR_NODE,
+	NEXUS_IVAR_NAME,
+	NEXUS_IVAR_DEVICE_TYPE,
+	NEXUS_IVAR_COMPATIBLE,
+};
+
 struct nexus_devinfo {
 	phandle_t	ndi_node;
 	/* Some common properties. */

Modified: head/sys/powerpc/aim/ofw_machdep.c
==============================================================================
--- head/sys/powerpc/aim/ofw_machdep.c	Tue Oct 14 12:26:55 2008	(r183881)
+++ head/sys/powerpc/aim/ofw_machdep.c	Tue Oct 14 14:54:14 2008	(r183882)
@@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -56,7 +57,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 
 #define	OFMEM_REGIONS	32
 static struct mem_region OFmem[OFMEM_REGIONS + 1], OFavail[OFMEM_REGIONS + 3];
@@ -282,7 +282,7 @@ OF_getetheraddr(device_t dev, u_char *ad
 {
 	phandle_t	node;
 
-	node = ofw_pci_find_node(dev);
+	node = ofw_bus_get_node(dev);
 	OF_getprop(node, "local-mac-address", addr, ETHER_ADDR_LEN);
 }
 

Modified: head/sys/powerpc/ofw/ofw_pcib_pci.c
==============================================================================
--- head/sys/powerpc/ofw/ofw_pcib_pci.c	Tue Oct 14 12:26:55 2008	(r183881)
+++ head/sys/powerpc/ofw/ofw_pcib_pci.c	Tue Oct 14 14:54:14 2008	(r183882)
@@ -35,8 +35,7 @@
 
 #include 
 #include 
-
-#include 
+#include 
 
 #include 
 #include 
@@ -46,6 +45,7 @@
 
 static int	ofw_pcib_pci_probe(device_t bus);
 static int	ofw_pcib_pci_attach(device_t bus);
+static phandle_t ofw_pcib_pci_get_node(device_t bus, device_t dev);
 
 static device_method_t ofw_pcib_pci_methods[] = {
 	/* Device interface */
@@ -72,6 +72,9 @@ static device_method_t ofw_pcib_pci_meth
 	DEVMETHOD(pcib_write_config,	pcib_write_config),
 	DEVMETHOD(pcib_route_interrupt,	pcib_route_interrupt),
 
+	/* ofw_bus interface */
+	DEVMETHOD(ofw_bus_get_node,     ofw_pcib_pci_get_node),
+
 	{0, 0}
 };
 
@@ -89,29 +92,29 @@ ofw_pcib_pci_probe(device_t dev)
 	    (pci_get_subclass(dev) != PCIS_BRIDGE_PCI)) {
 		return (ENXIO);
 	}
-	if (ofw_pci_find_node(dev) == 0) {
+
+	if (ofw_bus_get_node(dev) == 0)
 		return (ENXIO);
-	}
 
-	device_set_desc(dev, "Open Firmware PCI-PCI bridge");
-	return (-1000);
+	device_set_desc(dev, "OFW PCI-PCI bridge");
+	return (0);
 }
 
 static int
 ofw_pcib_pci_attach(device_t dev)
 {
-	phandle_t	node;
-	uint32_t	busrange[2];
-
-	node = ofw_pci_find_node(dev);
-	if (OF_getprop(node, "bus-range", busrange, sizeof(busrange)) != 8)
-		return (ENXIO);
-
 	pcib_attach_common(dev);
 
-	ofw_pci_fixup(dev, busrange[0], node);
-
 	device_add_child(dev, "pci", -1);
 
 	return (bus_generic_attach(dev));
 }
+
+phandle_t
+ofw_pcib_pci_get_node(device_t bridge, device_t dev)
+{
+	/* We have only one child, the PCI bus, so pass it our node */
+
+	return (ofw_bus_get_node(bridge));
+}
+

Added: head/sys/powerpc/ofw/ofw_pcibus.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sys/powerpc/ofw/ofw_pcibus.c	Tue Oct 14 14:54:14 2008	(r183882)
@@ -0,0 +1,359 @@
+/*-
+ * Copyright (c) 1994 Charles M. Hannum.  All rights reserved.
+ * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
+ * Copyright (c) 1997, Stefan Esser 
+ * Copyright (c) 2000, Michael Smith 
+ * Copyright (c) 2000, BSDi
+ * Copyright (c) 2003, Thomas Moestl 
+ * 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 unmodified, 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 ``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 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 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include "pcib_if.h"
+#include "pci_if.h"
+
+/* Helper functions */
+static int  find_node_intr(phandle_t, u_int32_t *, u_int32_t *);
+static int  ofw_pci_find_intline(phandle_t node, uint32_t *irqs);
+static void ofw_pci_fixup_node(device_t dev, phandle_t node);
+
+/* Methods */
+static device_probe_t ofw_pcibus_probe;
+static device_attach_t ofw_pcibus_attach;
+static pci_assign_interrupt_t ofw_pcibus_assign_interrupt;
+static ofw_bus_get_devinfo_t ofw_pcibus_get_devinfo;
+
+static device_method_t ofw_pcibus_methods[] = {
+	/* Device interface */
+	DEVMETHOD(device_probe,		ofw_pcibus_probe),
+	DEVMETHOD(device_attach,	ofw_pcibus_attach),
+
+	/* PCI interface */
+	DEVMETHOD(pci_assign_interrupt, ofw_pcibus_assign_interrupt),
+
+	/* ofw_bus interface */
+	DEVMETHOD(ofw_bus_get_devinfo,	ofw_pcibus_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 }
+};
+
+struct ofw_pcibus_devinfo {
+	struct pci_devinfo	opd_dinfo;
+	struct ofw_bus_devinfo	opd_obdinfo;
+};
+
+static devclass_t pci_devclass;
+
+DEFINE_CLASS_1(pci, ofw_pcibus_driver, ofw_pcibus_methods, 1 /* no softc */,
+    pci_driver);
+DRIVER_MODULE(ofw_pcibus, pcib, ofw_pcibus_driver, pci_devclass, 0, 0);
+MODULE_VERSION(ofw_pcibus, 1);
+MODULE_DEPEND(ofw_pcibus, pci, 1, 1, 1);
+
+static int
+ofw_pcibus_probe(device_t dev)
+{
+	if (ofw_bus_get_node(dev) == 0)
+		return (ENXIO);
+	device_set_desc(dev, "OFW PCI bus");
+
+	return (0);
+}
+
+static int
+ofw_pcibus_attach(device_t dev)
+{
+	device_t pcib;
+	struct ofw_pci_register pcir;
+	struct ofw_pcibus_devinfo *dinfo;
+	phandle_t node, child;
+	u_int busno, domain, func, slot;
+
+	pcib = device_get_parent(dev);
+	domain = pcib_get_domain(dev);
+	busno = pcib_get_bus(dev);
+	if (bootverbose)
+		device_printf(dev, "domain=%d, physical bus=%d\n",
+		    domain, busno);
+	node = ofw_bus_get_node(dev);
+
+	for (child = OF_child(node); child != 0; child = OF_peer(child)) {
+		if (OF_getprop(child, "reg", &pcir, sizeof(pcir)) == -1)
+			continue;
+		slot = OFW_PCI_PHYS_HI_DEVICE(pcir.phys_hi);
+		func = OFW_PCI_PHYS_HI_FUNCTION(pcir.phys_hi);
+
+		/* Some OFW device trees contain dupes. */
+		if (pci_find_dbsf(domain, busno, slot, func) != NULL)
+			continue;
+
+		ofw_pci_fixup_node(pcib, child);
+
+		dinfo = (struct ofw_pcibus_devinfo *)pci_read_device(pcib,
+		    domain, busno, slot, func, sizeof(*dinfo));
+
+		if (dinfo == NULL)
+			continue;
+
+		/* Set up OFW devinfo */
+		if (ofw_bus_gen_setup_devinfo(&dinfo->opd_obdinfo, child) !=
+		    0) {
+			pci_freecfg((struct pci_devinfo *)dinfo);
+			continue;
+		}
+
+		pci_add_child(dev, (struct pci_devinfo *)dinfo);
+
+		/*
+		 * Some devices don't have an intpin set, but do have
+		 * interrupts. Add them to the appropriate resource list.
+		 */
+		if (dinfo->opd_dinfo.cfg.intpin == 0) {
+			uint32_t irqs[4];
+
+			if (ofw_pci_find_intline(child, irqs) > 0)
+				resource_list_add(&dinfo->opd_dinfo.resources, 
+				    SYS_RES_IRQ, 0, irqs[0], irqs[0], 1);
+		}
+	}
+
+	return (bus_generic_attach(dev));
+}
+
+static int
+ofw_pcibus_assign_interrupt(device_t dev, device_t child)
+{
+	uint32_t irqs[4];
+
+	device_printf(child,"Assigning interrupt\n");
+
+	if (ofw_pci_find_intline(ofw_bus_get_node(child), irqs) < 0)
+		return PCI_INVALID_IRQ;
+
+	device_printf(child,"IRQ %d\n",irqs[0]);
+
+	return irqs[0];
+
+//	return (PCIB_ROUTE_INTERRUPT(device_get_parent(dev), child, intr));
+}
+
+static const struct ofw_bus_devinfo *
+ofw_pcibus_get_devinfo(device_t bus, device_t dev)
+{
+	struct ofw_pcibus_devinfo *dinfo;
+
+	dinfo = device_get_ivars(dev);
+	return (&dinfo->opd_obdinfo);
+}
+
+static void
+ofw_pci_fixup_node(device_t dev, phandle_t node)
+{
+	uint32_t	csr, intr, irqs[4];
+	struct		ofw_pci_register addr[8];
+	int		len, i;
+
+	len = OF_getprop(node, "assigned-addresses", addr, sizeof(addr));
+	if (len < (int)sizeof(struct ofw_pci_register)) {
+		return;
+	}
+
+	csr = PCIB_READ_CONFIG(dev, OFW_PCI_PHYS_HI_BUS(addr[0].phys_hi),
+	    OFW_PCI_PHYS_HI_DEVICE(addr[0].phys_hi),
+	    OFW_PCI_PHYS_HI_FUNCTION(addr[0].phys_hi), PCIR_COMMAND, 4);
+	csr &= ~(PCIM_CMD_PORTEN | PCIM_CMD_MEMEN);
+
+	for (i = 0; i < len / sizeof(struct ofw_pci_register); i++) {
+		switch (addr[i].phys_hi & OFW_PCI_PHYS_HI_SPACEMASK) {
+		case OFW_PCI_PHYS_HI_SPACE_IO:
+			csr |= PCIM_CMD_PORTEN;
+			break;
+		case OFW_PCI_PHYS_HI_SPACE_MEM32:
+			csr |= PCIM_CMD_MEMEN;
+			break;
+		}
+	}
+
+	PCIB_WRITE_CONFIG(dev, OFW_PCI_PHYS_HI_BUS(addr[0].phys_hi),
+	    OFW_PCI_PHYS_HI_DEVICE(addr[0].phys_hi),
+	    OFW_PCI_PHYS_HI_FUNCTION(addr[0].phys_hi), PCIR_COMMAND, csr, 4);
+
+	if (ofw_pci_find_intline(node, irqs) != -1) {
+		intr = PCIB_READ_CONFIG(dev,
+		    OFW_PCI_PHYS_HI_BUS(addr[0].phys_hi),
+		    OFW_PCI_PHYS_HI_DEVICE(addr[0].phys_hi),
+		    OFW_PCI_PHYS_HI_FUNCTION(addr[0].phys_hi), PCIR_INTLINE, 2);
+		intr &= ~(0xff);
+		intr |= irqs[0] & 0xff;
+		PCIB_WRITE_CONFIG(dev,
+		    OFW_PCI_PHYS_HI_BUS(addr[0].phys_hi),
+		    OFW_PCI_PHYS_HI_DEVICE(addr[0].phys_hi),
+		    OFW_PCI_PHYS_HI_FUNCTION(addr[0].phys_hi), PCIR_INTLINE,
+		    intr, 2);
+	}
+}
+
+static int
+ofw_pci_find_intline(phandle_t node, uint32_t *irqs)
+{
+	uint32_t	npintr, paddr[4];
+	struct		ofw_pci_register addr[8];
+	int		len;
+
+	len = OF_getprop(node, "assigned-addresses", addr, sizeof(addr));
+	if (len < (int)sizeof(struct ofw_pci_register)) 
+		return -1;
+	/*
+	 * Create PCI interrupt-map array element. pci-mid/pci-lo
+	 * aren't required, but the 'interrupts' property needs
+	 * to be appended
+	 */
+	npintr = 0;
+	OF_getprop(node, "interrupts", &npintr, 4);
+	paddr[0] = addr[0].phys_hi;
+	paddr[1] = 0;
+	paddr[2] = 0;
+	paddr[3] = npintr;
+
+	return find_node_intr(node, paddr, irqs);
+}
+
+static int
+find_node_intr(phandle_t node, u_int32_t *addr, u_int32_t *intr)
+{
+	phandle_t	parent, iparent;
+	int		len, mlen, match, i;
+	u_int32_t	map[160], *mp, imask[8], maskedaddr[8], icells;
+	char		name[32];
+
+	len = OF_getprop(node, "AAPL,interrupts", intr, 4);
+	if (len == 4) {
+		return (len);
+	}
+
+	parent = OF_parent(node);
+	len = OF_getprop(parent, "interrupt-map", map, sizeof(map));
+	mlen = OF_getprop(parent, "interrupt-map-mask", imask, sizeof(imask));
+
+	if (len == -1 || mlen == -1)
+		goto nomap;
+
+	memcpy(maskedaddr, addr, mlen);
+	for (i = 0; i < mlen/4; i++)
+		maskedaddr[i] &= imask[i];
+
+	mp = map;
+	while (len > mlen) {
+		match = bcmp(maskedaddr, mp, mlen);
+		mp += mlen / 4;
+		len -= mlen;
+
+		/*
+		 * We must read "#interrupt-cells" for each time because
+		 * interrupt-parent may be different.
+		 */
+		iparent = *mp++;
+		len -= 4;
+		if (OF_getprop(iparent, "#interrupt-cells", &icells, 4) != 4)
+			goto nomap;
+
+		/* Found. */
+		if (match == 0) {
+			bcopy(mp, intr, icells * 4);
+			return (icells * 4);
+		}
+
+		mp += icells;
+		len -= icells * 4;
+	}
+
+nomap:
+	/*
+	 * Check for local properties indicating interrupts
+	 */
+
+	len = OF_getprop(node, "interrupts", intr, 16);
+	if (OF_getprop(node, "interrupt-parent", &iparent, sizeof(iparent)) ==
+	   sizeof(iparent)) {
+		OF_getprop(iparent, "#interrupt-cells", &icells, sizeof(icells));
+		for (i = 0; i < len/icells/4; i++)
+			intr[i] = intr[i*icells];
+
+		return (len);
+	}
+	
+
+	/*
+	 * If the node has no interrupt property and the parent is a PCI
+	 * bridge, use the parent's interrupt.  This occurs on a PCI slot.
+	 */
+	bzero(name, sizeof(name));
+	OF_getprop(parent, "name", name, sizeof(name));
+	if (strcmp(name, "pci-bridge") == 0) {
+		len = OF_getprop(parent, "AAPL,interrupts", intr, 4);
+		if (len == 4) {
+			return (len);
+		}
+
+		/*
+		 * XXX I don't know what is the correct local address.
+		 * XXX Use the first entry for now.
+		 */
+		len = OF_getprop(parent, "interrupt-map", map, sizeof(map));
+		if (len >= 36) {
+			addr = &map[5];
+			/* XXX Use 0 for 'interrupts' for compat */
+			return (find_node_intr(parent, addr, intr));
+		}
+	}
+
+	return (-1);
+}
+

Modified: head/sys/powerpc/ofw/ofw_syscons.c
==============================================================================
--- head/sys/powerpc/ofw/ofw_syscons.c	Tue Oct 14 12:26:55 2008	(r183881)
+++ head/sys/powerpc/ofw/ofw_syscons.c	Tue Oct 14 14:54:14 2008	(r183882)
@@ -53,7 +53,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 
 static int ofwfb_ignore_mmap_checks;
 SYSCTL_NODE(_hw, OID_AUTO, ofwfb, CTLFLAG_RD, 0, "ofwfb");
@@ -841,19 +840,11 @@ ofwfb_scidentify(driver_t *driver, devic
 	 * the device list
 	 */
 	child = BUS_ADD_CHILD(parent, INT_MAX, SC_DRIVER_NAME, 0);
-	if (child != NULL)
-		nexus_set_device_type(child, "syscons");
 }
 
 static int
 ofwfb_scprobe(device_t dev)
 {
-	char *name;
-
-	name = nexus_get_name(dev);
-	if (strcmp(SC_DRIVER_NAME, name) != 0)
-		return (ENXIO);
-
 	device_set_desc(dev, "System console");
 	return (sc_probe_unit(device_get_unit(dev), 
 	    device_get_flags(dev) | SC_AUTODETECT_KBD));

Modified: head/sys/powerpc/powermac/ata_kauai.c
==============================================================================
--- head/sys/powerpc/powermac/ata_kauai.c	Tue Oct 14 12:26:55 2008	(r183881)
+++ head/sys/powerpc/powermac/ata_kauai.c	Tue Oct 14 14:54:14 2008	(r183882)
@@ -50,7 +50,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
-#include 
+#include 
 #include 
 
 #include 
@@ -194,11 +194,10 @@ ata_kauai_probe(device_t dev)
 {
 	struct ata_channel *ch;
 	struct ata_kauai_softc *sc;
-	u_long startp, countp;
 	u_int32_t devid;
 	phandle_t node;
-	char *compatstring = NULL;
-	int i, found, rid, status;
+	const char *compatstring = NULL;
+	int i, found, rid;
 
 	found = 0;
 	devid = pci_get_devid(dev);
@@ -212,59 +211,18 @@ ata_kauai_probe(device_t dev)
 	if (!found)
 		return (ENXIO);
 
-	node = ofw_pci_find_node(dev);
+	node = ofw_bus_get_node(dev);
 	sc = device_get_softc(dev);
 	bzero(sc, sizeof(struct ata_kauai_softc));
 	ch = &sc->sc_ch.sc_ch;
 
-	OF_getprop_alloc(node, "compatible", 1, (void **)&compatstring);
-	if (strcmp(compatstring,"shasta-ata") == 0)
+	compatstring = ofw_bus_get_compat(dev);
+	if (compatstring != NULL && strcmp(compatstring,"shasta-ata") == 0)
 		sc->shasta = 1;
 
-	free(compatstring, M_OFWPROP);
-
-
-	/*
-	 * This device seems to ignore writes to the interrupt
-	 * config register, resulting in interrupt resources
-	 * not being attached. If this is the case, use
-	 * Open Firmware to determine the irq, and then attach
-	 * the resource. This allows the ATA common code to
-	 * allocate the irq.
-	 */
-	status = bus_get_resource(dev, SYS_RES_IRQ, 0, &startp, &countp);
-	if (status == ENOENT) {
-		int *irq;
-		phandle_t iparent;
-		int icells, nintr, i;
-
-		/*
-		 * Horrible hack to handle Kauai devices that have their IRQs
-		 * set up in an utterly wrong way
-		 */
-		if (!sc->shasta)
-			bus_set_resource(dev, SYS_RES_IRQ, 0, 39, 1);
-
-		/*
-		 * For the rest of the interrupts, and the main Shasta
-		 * interrupt, get the IRQs from firmware.
-		 */
-		if (OF_getprop(node, "interrupt-parent", &iparent, 
-		    sizeof(iparent)) == sizeof(iparent)) {
-			OF_getprop(iparent, "#interrupt-cells", &icells, 
-			    sizeof(icells)) ;
-		}
-
-		nintr = OF_getprop_alloc(node, "interrupts", sizeof(*irq),
-		    (void **)&irq);
-
-		for (i = 0; i < nintr; i += icells)
-			bus_set_resource(dev, SYS_RES_IRQ, 
-			    i/icells + !sc->shasta, irq[i], 1);
-
-		free(irq, M_OFWPROP);
-	}
-
+	/* Regular Kauai controllers apparently need this hack */
+	if (!sc->shasta)
+		bus_set_resource(dev, SYS_RES_IRQ, 0, 39, 1);
 
         rid = PCIR_BARS;
 	sc->sc_memr = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, 

Modified: head/sys/powerpc/powermac/grackle.c
==============================================================================
--- head/sys/powerpc/powermac/grackle.c	Tue Oct 14 12:26:55 2008	(r183881)
+++ head/sys/powerpc/powermac/grackle.c	Tue Oct 14 14:54:14 2008	(r183882)
@@ -36,19 +36,18 @@
 
 #include 
 #include 
+#include 
 
 #include 
 #include 
 
 #include 
 #include 
-#include 
 #include 
 #include 
 
 #include 
 
-#include 
 #include 
 
 #include 
@@ -92,6 +91,11 @@ static void		grackle_write_config(device
 static int		grackle_route_interrupt(device_t, device_t, int);
 
 /*
+ * ofw_bus interface
+ */
+static phandle_t grackle_get_node(device_t bus, device_t dev);
+
+/*
  * Local routines.
  */
 static int		grackle_enable_config(struct grackle_softc *, u_int,
@@ -122,6 +126,9 @@ static device_method_t	grackle_methods[]
 	DEVMETHOD(pcib_write_config,	grackle_write_config),
 	DEVMETHOD(pcib_route_interrupt,	grackle_route_interrupt),
 
+	/* ofw_bus interface */
+	DEVMETHOD(ofw_bus_get_node,     grackle_get_node),
+
 	{ 0, 0 }
 };
 
@@ -138,10 +145,10 @@ DRIVER_MODULE(grackle, nexus, grackle_dr
 static int
 grackle_probe(device_t dev)
 {
-	char	*type, *compatible;
+	const char	*type, *compatible;
 
-	type = nexus_get_device_type(dev);
-	compatible = nexus_get_compatible(dev);
+	type = ofw_bus_get_type(dev);
+	compatible = ofw_bus_get_compat(dev);
 
 	if (type == NULL || compatible == NULL)
 		return (ENXIO);
@@ -162,7 +169,7 @@ grackle_attach(device_t dev)
 	struct		grackle_range *rp, *io, *mem[2];
 	int		nmem, i, error;
 
-	node = nexus_get_node(dev);
+	node = ofw_bus_get_node(dev);
 	sc = device_get_softc(dev);
 
 	if (OF_getprop(node, "bus-range", busrange, sizeof(busrange)) != 8)
@@ -244,12 +251,6 @@ grackle_attach(device_t dev)
 		}
 	}
 
-	/*
-	 * Write out the correct PIC interrupt values to config space
-	 * of all devices on the bus.
-	 */
-	ofw_pci_fixup(dev, sc->sc_bus, sc->sc_node);
-
 	device_add_child(dev, "pci", device_get_unit(dev));
 	return (bus_generic_attach(dev));
 }
@@ -511,6 +512,17 @@ grackle_disable_config(struct grackle_so
 	out32rb(sc->sc_addr, 0);
 }
 
+static phandle_t
+grackle_get_node(device_t bus, device_t dev)
+{
+	struct grackle_softc *sc;
+
+	sc = device_get_softc(bus);
+	/* We only have one child, the PCI bus, which needs our own node. */
+
+	return sc->sc_node;
+}
+
 /*
  * Driver to swallow Grackle host bridges from the PCI bus side.
  */

Modified: head/sys/powerpc/powermac/hrowpic.c
==============================================================================
--- head/sys/powerpc/powermac/hrowpic.c	Tue Oct 14 12:26:55 2008	(r183881)
+++ head/sys/powerpc/powermac/hrowpic.c	Tue Oct 14 14:54:14 2008	(r183882)
@@ -48,7 +48,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 

Modified: head/sys/powerpc/powermac/macio.c
==============================================================================
--- head/sys/powerpc/powermac/macio.c	Tue Oct 14 12:26:55 2008	(r183881)
+++ head/sys/powerpc/powermac/macio.c	Tue Oct 14 14:54:14 2008	(r183882)
@@ -139,6 +139,8 @@ static struct macio_pci_dev {
 	{ 0x0022106b, "KeyLargo I/O Controller" },
 	{ 0x0025106b, "Pangea I/O Controller" },
 	{ 0x003e106b, "Intrepid I/O Controller" },
+	{ 0x0041106b, "K2 KeyLargo I/O Controller" },
+	{ 0x004f106b, "Shasta I/O Controller" },
 	{ 0, NULL }
 };
 
@@ -270,7 +272,7 @@ macio_attach(device_t dev)
 	int error, quirks;
 
 	sc = device_get_softc(dev);
-	root = sc->sc_node = OF_finddevice("mac-io");
+	root = sc->sc_node = ofw_bus_get_node(dev);
 	
 	/*
 	 * Locate the device node and it's base address

Modified: head/sys/powerpc/powermac/openpic_macio.c
==============================================================================
--- head/sys/powerpc/powermac/openpic_macio.c	Tue Oct 14 12:26:55 2008	(r183881)
+++ head/sys/powerpc/powermac/openpic_macio.c	Tue Oct 14 14:54:14 2008	(r183882)
@@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 

Modified: head/sys/powerpc/powermac/uninorth.c
==============================================================================
--- head/sys/powerpc/powermac/uninorth.c	Tue Oct 14 12:26:55 2008	(r183881)
+++ head/sys/powerpc/powermac/uninorth.c	Tue Oct 14 14:54:14 2008	(r183882)
@@ -34,19 +34,18 @@
 
 #include 
 #include 
+#include 
 
 #include 
 #include 
 
 #include 
 #include 
-#include 
 #include 
 #include 
 
 #include 
 
-#include 
 #include 
 
 #include 
@@ -84,6 +83,12 @@ static void		uninorth_write_config(devic
 static int		uninorth_route_interrupt(device_t, device_t, int);
 
 /*
+ * OFW Bus interface
+ */
+
+static phandle_t	 uninorth_get_node(device_t bus, device_t dev);
+
+/*
  * Local routines.
  */
 static int		uninorth_enable_config(struct uninorth_softc *, u_int,
@@ -112,6 +117,9 @@ static device_method_t	uninorth_methods[
 	DEVMETHOD(pcib_write_config,	uninorth_write_config),
 	DEVMETHOD(pcib_route_interrupt,	uninorth_route_interrupt),
 
+	/* ofw_bus interface */
+	DEVMETHOD(ofw_bus_get_node,     uninorth_get_node),
+
 	{ 0, 0 }
 };
 
@@ -128,32 +136,40 @@ DRIVER_MODULE(uninorth, nexus, uninorth_
 static int
 uninorth_probe(device_t dev)
 {
-	char	*type, *compatible;
+	const char	*type, *compatible;
 
-	type = nexus_get_device_type(dev);
-	compatible = nexus_get_compatible(dev);
+	type = ofw_bus_get_type(dev);
+	compatible = ofw_bus_get_compat(dev);
 
 	if (type == NULL || compatible == NULL)
 		return (ENXIO);
 
-	if (strcmp(type, "pci") != 0 || strcmp(compatible, "uni-north") != 0)
+	if (strcmp(type, "pci") != 0)
 		return (ENXIO);
 
-	device_set_desc(dev, "Apple UniNorth Host-PCI bridge");
-	return (0);
+	if (strcmp(compatible, "uni-north") == 0) {
+		device_set_desc(dev, "Apple UniNorth Host-PCI bridge");
+		return (0);
+	} else if (strcmp(compatible,"u3-agp") == 0) {
+		device_set_desc(dev, "Apple U3 Host-AGP bridge");
+		return (0);
+	}
+	
+	return (ENXIO);
 }
 
 static int
 uninorth_attach(device_t dev)
 {
 	struct		uninorth_softc *sc;
+	const char	*compatible;
 	phandle_t	node;
 	phandle_t	child;
 	u_int32_t	reg[2], busrange[2];
 	struct		uninorth_range *rp, *io, *mem[2];
 	int		nmem, i, error;
 
-	node = nexus_get_node(dev);
+	node = ofw_bus_get_node(dev);
 	sc = device_get_softc(dev);
 
 	if (OF_getprop(node, "reg", reg, sizeof(reg)) < 8)
@@ -162,15 +178,48 @@ uninorth_attach(device_t dev)
 	if (OF_getprop(node, "bus-range", busrange, sizeof(busrange)) != 8)
 		return (ENXIO);
 
+	sc->sc_u3 = 0;
+	compatible = ofw_bus_get_compat(dev);
+	if (strcmp(compatible,"u3-agp") == 0)
+		sc->sc_u3 = 1;
+
 	sc->sc_dev = dev;
 	sc->sc_node = node;
-	sc->sc_addr = (vm_offset_t)pmap_mapdev(reg[0] + 0x800000, PAGE_SIZE);
-	sc->sc_data = (vm_offset_t)pmap_mapdev(reg[0] + 0xc00000, PAGE_SIZE);
+	if (sc->sc_u3) {
+	   sc->sc_addr = (vm_offset_t)pmap_mapdev(reg[1] + 0x800000, PAGE_SIZE);
+	   sc->sc_data = (vm_offset_t)pmap_mapdev(reg[1] + 0xc00000, PAGE_SIZE);
+	} else {
+	   sc->sc_addr = (vm_offset_t)pmap_mapdev(reg[0] + 0x800000, PAGE_SIZE);
+	   sc->sc_data = (vm_offset_t)pmap_mapdev(reg[0] + 0xc00000, PAGE_SIZE);
+	}
 	sc->sc_bus = busrange[0];
 
 	bzero(sc->sc_range, sizeof(sc->sc_range));
-	sc->sc_nrange = OF_getprop(node, "ranges", sc->sc_range,
-	    sizeof(sc->sc_range));
+	if (sc->sc_u3) {
+		/*
+		 * On Apple U3 systems, we have an otherwise standard
+		 * Uninorth controller driving AGP. The one difference
+		 * is that it uses a new PCI ranges format, so do the
+		 * translation.
+		 */
+
+		struct uninorth_range64 range64[6];
+		bzero(range64, sizeof(range64));
+
+		sc->sc_nrange = OF_getprop(node, "ranges", range64,
+		    sizeof(range64));
+		for (i = 0; range64[i].pci_hi != 0; i++) {
+			sc->sc_range[i].pci_hi = range64[i].pci_hi;
+			sc->sc_range[i].pci_mid = range64[i].pci_mid;
+			sc->sc_range[i].pci_lo = range64[i].pci_lo;
+			sc->sc_range[i].host = range64[i].host_lo;
+			sc->sc_range[i].size_hi = range64[i].size_hi;
+			sc->sc_range[i].size_lo = range64[i].size_lo;
+		}
+	} else {
+		sc->sc_nrange = OF_getprop(node, "ranges", sc->sc_range,
+		    sizeof(sc->sc_range));
+	}
 
 	if (sc->sc_nrange == -1) {
 		device_printf(dev, "could not get ranges\n");
@@ -245,13 +294,6 @@ uninorth_attach(device_t dev)
 		}
 	}
 
-	/*
-	 * Write out the correct PIC interrupt values to config space
-	 * of all devices on the bus. This has to be done after the GEM
-	 * cell is enabled above.
-	 */
-	ofw_pci_fixup(dev, sc->sc_bus, node);
-
 	device_add_child(dev, "pci", device_get_unit(dev));
 	return (bus_generic_attach(dev));
 }
@@ -275,7 +317,7 @@ uninorth_read_config(device_t dev, u_int
 
 	if (uninorth_enable_config(sc, bus, slot, func, reg) != 0) {
 		switch (width) {
-		case 1:
+		case 1: 
 			return (in8rb(caoff));
 			break;
 		case 2:
@@ -467,6 +509,17 @@ uninorth_enable_config(struct uninorth_s
 	return (1);
 }
 
+static phandle_t
+uninorth_get_node(device_t bus, device_t dev)
+{
+	struct uninorth_softc *sc;
+
+	sc = device_get_softc(bus);
+	/* We only have one child, the PCI bus, which needs our own node. */
+
+	return sc->sc_node;
+}
+
 /*
  * Driver to swallow UniNorth host bridges from the PCI bus side.
  */
@@ -533,9 +586,9 @@ unin_enable_gmac(void)
 static int
 unin_chip_probe(device_t dev)
 {
-	char	*name;
+	const char	*name;
 
-	name = nexus_get_name(dev);
+	name = ofw_bus_get_name(dev);
 
 	if (name == NULL)

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-head@FreeBSD.ORG  Tue Oct 14 15:01:41 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DB7FB106569C
	for ; Tue, 14 Oct 2008 15:01:41 +0000 (UTC)
	(envelope-from max@love2party.net)
Received: from moutng.kundenserver.de (moutng.kundenserver.de
	[212.227.126.186])
	by mx1.freebsd.org (Postfix) with ESMTP id 690858FC3B
	for ; Tue, 14 Oct 2008 15:01:41 +0000 (UTC)
	(envelope-from max@love2party.net)
Received: from vampire.homelinux.org (dslb-088-066-016-013.pools.arcor-ip.net
	[88.66.16.13])
	by mrelayeu.kundenserver.de (node=mrelayeu6) with ESMTP (Nemesis)
	id 0ML29c-1KplCs06hE-0008AE; Tue, 14 Oct 2008 16:49:06 +0200
Received: (qmail 320 invoked from network); 14 Oct 2008 14:49:05 -0000
Received: from fbsd8.laiers.local (192.168.4.151)
	by laiers.local with SMTP; 14 Oct 2008 14:49:05 -0000
From: Max Laier 
Organization: FreeBSD
To: Roman Kurakin 
Date: Tue, 14 Oct 2008 16:49:04 +0200
User-Agent: KMail/1.10.1 (FreeBSD/8.0-CURRENT; KDE/4.1.1; i386; ; )
References: <200810141226.m9ECQtPW006469@svn.freebsd.org>
	<48F4A9A5.8020605@inse.ru>
In-Reply-To: <48F4A9A5.8020605@inse.ru>
MIME-Version: 1.0
Content-Type: text/plain;
  charset="utf-8"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-Id: <200810141649.04834.max@love2party.net>
X-Provags-ID: V01U2FsdGVkX18zVnSd4lgC7a0xZ8OrffmwZ4DpfvdniGEfhDX
	B/u0rZhi0yVEyU/W9PkJEcf4sms0J0JBaFXLt0noN/oLOAMfBR
	m4ifTt60phveUu7kwiBnQ==
Cc: Maxim Konovalov , svn-src-head@freebsd.org,
	svn-src-all@freebsd.org, src-committers@freebsd.org
Subject: Re: svn commit: r183881 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 14 Oct 2008 15:01:42 -0000

On Tuesday 14 October 2008 16:16:05 Roman Kurakin wrote:
> Maxim Konovalov:
> > Author: maxim
> > Date: Tue Oct 14 12:26:55 2008
> > New Revision: 183881
> > URL: http://svn.freebsd.org/changeset/base/183881
> >
> > Log:
> >   o Reformat ipfw nat get|setsockopt code to look it  more
> >   style(9) compliant.  No functional changes.
> >
> > Modified:
> >   head/sys/netinet/ip_fw2.c
> >
> > Modified: head/sys/netinet/ip_fw2.c
> > =========================================================================
> >===== --- head/sys/netinet/ip_fw2.c	Tue Oct 14 10:23:11 2008	(r183880) +++
> > head/sys/netinet/ip_fw2.c	Tue Oct 14 12:26:55 2008	(r183881) @@ -4385,49
> > +4385,52 @@ ipfw_ctl(struct sockopt *sopt)
> >  		break;
> >
> >  	case IP_FW_NAT_CFG:
> > -	{
> > -		if (IPFW_NAT_LOADED)
> > -			error = ipfw_nat_cfg_ptr(sopt);
> > -		else {
> > -			printf("IP_FW_NAT_CFG: ipfw_nat not present, please load it.\n");
> > -			error = EINVAL;
> > +		{
> > +			if (IPFW_NAT_LOADED)
> > +				error = ipfw_nat_cfg_ptr(sopt);
> > +			else {
> > +				printf("IP_FW_NAT_CFG: %s\n",
> > +				    "ipfw_nat not present, please load it");
> > +				error = EINVAL;
> > +			}
> >  		}
>
> IMHO such indention does not add any usefulness, but increases indention
> level that is already very high.
> Also I do not see strict contradiction to the style(9), but probably I
> am not reading the most current style(9).

The additional scope is absolutely unnecessary here and should be dropped - 
IMHO.  See case IP_FW_RESETLOG and above.

-- 
/"\  Best regards,                      | mlaier@freebsd.org
\ /  Max Laier                          | ICQ #67774661
 X   http://pf4freebsd.love2party.net/  | mlaier@EFnet
/ \  ASCII Ribbon Campaign              | Against HTML Mail and News

From owner-svn-src-head@FreeBSD.ORG  Tue Oct 14 15:08:25 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BF4C0106568B;
	Tue, 14 Oct 2008 15:08:25 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from pele.citylink.co.nz (pele.citylink.co.nz [202.8.44.226])
	by mx1.freebsd.org (Postfix) with ESMTP id 5E8D18FC1F;
	Tue, 14 Oct 2008 15:08:25 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from localhost (localhost [127.0.0.1])
	by pele.citylink.co.nz (Postfix) with ESMTP id 01CE52BC52;
	Wed, 15 Oct 2008 03:42:50 +1300 (NZDT)
X-Virus-Scanned: Debian amavisd-new at citylink.co.nz
Received: from pele.citylink.co.nz ([127.0.0.1])
	by localhost (pele.citylink.co.nz [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id ebfih1FxfW+w; Wed, 15 Oct 2008 03:42:45 +1300 (NZDT)
Received: from citylink.fud.org.nz (unknown [202.8.44.45])
	by pele.citylink.co.nz (Postfix) with ESMTP;
	Wed, 15 Oct 2008 03:42:45 +1300 (NZDT)
Received: by citylink.fud.org.nz (Postfix, from userid 1001)
	id CB48811430; Wed, 15 Oct 2008 03:42:44 +1300 (NZDT)
Date: Tue, 14 Oct 2008 07:42:44 -0700
From: Andrew Thompson 
To: Nick Hibma 
Message-ID: <20081014144244.GA94595@citylink.fud.org.nz>
References: <200810140745.m9E7jBai099067@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <200810140745.m9E7jBai099067@svn.freebsd.org>
User-Agent: Mutt/1.5.17 (2007-11-01)
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r183868 - head/sys/dev/usb
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 14 Oct 2008 15:08:25 -0000

On Tue, Oct 14, 2008 at 07:45:11AM +0000, Nick Hibma wrote:
> Author: n_hibma
> Date: Tue Oct 14 07:45:11 2008
> New Revision: 183868
> URL: http://svn.freebsd.org/changeset/base/183868
> 
> Log:
>   - Fix the naming of the MC950D device.
>   - Remove the (unimplemented) U3GFL_EJECT quirk as this won't be implemented in
>     the u3g driver anyway (most probably as an entry in devd.conf)
> 
> Modified:
>   head/sys/dev/usb/u3g.c
>   head/sys/dev/usb/usbdevs
> 
> Modified: head/sys/dev/usb/usbdevs
> ==============================================================================
> --- head/sys/dev/usb/usbdevs	Tue Oct 14 07:24:18 2008	(r183867)
> +++ head/sys/dev/usb/usbdevs	Tue Oct 14 07:45:11 2008	(r183868)
> @@ -1839,7 +1839,7 @@ product NOVATEL X950D		0x1450	Merlin X95
>  product NOVATEL ES620		0x2100	ES620 CDMA
>  product NOVATEL U720		0x2110	Merlin U720
>  product NOVATEL U727		0x4100	Merlin U727 CDMA
> -product NOVATEL U950D		0x4400	Novatel MC950D HSUPA
> +product NOVATEL MC950D		0x4400	Novatel MC950D HSUPA
>  product NOVATEL ZEROCD		0x5010	Novatel ZeroCD
>  product NOVATEL2 FLEXPACKGPS	0x0100	NovAtel FlexPack GPS receiver

Once an entry is in usbdevs please do _not_ change it, even if its not
perfect. This will create conflicts for 3rd parties (me).


cheers,
Andrew

From owner-svn-src-head@FreeBSD.ORG  Tue Oct 14 15:19:02 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5A94E106568F;
	Tue, 14 Oct 2008 15:19:02 +0000 (UTC)
	(envelope-from n_hibma@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 48DD38FC28;
	Tue, 14 Oct 2008 15:19:02 +0000 (UTC)
	(envelope-from n_hibma@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9EFJ2LE009566;
	Tue, 14 Oct 2008 15:19:02 GMT (envelope-from n_hibma@svn.freebsd.org)
Received: (from n_hibma@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9EFJ2Mp009565;
	Tue, 14 Oct 2008 15:19:02 GMT (envelope-from n_hibma@svn.freebsd.org)
Message-Id: <200810141519.m9EFJ2Mp009565@svn.freebsd.org>
From: Nick Hibma 
Date: Tue, 14 Oct 2008 15:19:02 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183883 - head/sys/dev/usb
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 14 Oct 2008 15:19:02 -0000

Author: n_hibma
Date: Tue Oct 14 15:19:02 2008
New Revision: 183883
URL: http://svn.freebsd.org/changeset/base/183883

Log:
  Add back in the (incorrect) entry for the MC950D, as requested by Andrew
  Thompson. They should not be removed in support of 3rd party software.

Modified:
  head/sys/dev/usb/usbdevs

Modified: head/sys/dev/usb/usbdevs
==============================================================================
--- head/sys/dev/usb/usbdevs	Tue Oct 14 14:54:14 2008	(r183882)
+++ head/sys/dev/usb/usbdevs	Tue Oct 14 15:19:02 2008	(r183883)
@@ -1839,6 +1839,7 @@ product NOVATEL X950D		0x1450	Merlin X95
 product NOVATEL ES620		0x2100	ES620 CDMA
 product NOVATEL U720		0x2110	Merlin U720
 product NOVATEL U727		0x4100	Merlin U727 CDMA
+product NOVATEL U950D		0x4400	Novatel MC950D HSUPA
 product NOVATEL MC950D		0x4400	Novatel MC950D HSUPA
 product NOVATEL ZEROCD		0x5010	Novatel ZeroCD
 product NOVATEL2 FLEXPACKGPS	0x0100	NovAtel FlexPack GPS receiver

From owner-svn-src-head@FreeBSD.ORG  Tue Oct 14 15:30:17 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DF6F61065686;
	Tue, 14 Oct 2008 15:30:17 +0000 (UTC)
	(envelope-from n_hibma@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CD3268FC08;
	Tue, 14 Oct 2008 15:30:17 +0000 (UTC)
	(envelope-from n_hibma@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9EFUHPt009875;
	Tue, 14 Oct 2008 15:30:17 GMT (envelope-from n_hibma@svn.freebsd.org)
Received: (from n_hibma@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9EFUHNn009874;
	Tue, 14 Oct 2008 15:30:17 GMT (envelope-from n_hibma@svn.freebsd.org)
Message-Id: <200810141530.m9EFUHNn009874@svn.freebsd.org>
From: Nick Hibma 
Date: Tue, 14 Oct 2008 15:30:17 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183885 - head/share/man/man4
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 14 Oct 2008 15:30:18 -0000

Author: n_hibma
Date: Tue Oct 14 15:30:17 2008
New Revision: 183885
URL: http://svn.freebsd.org/changeset/base/183885

Log:
  Correct the name of the device.

Modified:
  head/share/man/man4/u3g.4

Modified: head/share/man/man4/u3g.4
==============================================================================
--- head/share/man/man4/u3g.4	Tue Oct 14 15:22:36 2008	(r183884)
+++ head/share/man/man4/u3g.4	Tue Oct 14 15:30:17 2008	(r183885)
@@ -72,7 +72,7 @@ Huawei E220 (E270?)
 .It
 Huawei Mobile
 .It
-Novatal U950D
+Novatal MC950D
 .El
 (See /sys/dev/u3g.c for the complete list of supported cards for each vendor
 mentioned above).

From owner-svn-src-head@FreeBSD.ORG  Tue Oct 14 16:13:40 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 27D30106568E;
	Tue, 14 Oct 2008 16:13:40 +0000 (UTC) (envelope-from sam@freebsd.org)
Received: from ebb.errno.com (ebb.errno.com [69.12.149.25])
	by mx1.freebsd.org (Postfix) with ESMTP id F2F148FC22;
	Tue, 14 Oct 2008 16:13:39 +0000 (UTC) (envelope-from sam@freebsd.org)
Received: from trouble.errno.com (trouble.errno.com [10.0.0.248])
	(authenticated bits=0)
	by ebb.errno.com (8.13.6/8.12.6) with ESMTP id m9EG1lrP029616
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Tue, 14 Oct 2008 09:01:47 -0700 (PDT) (envelope-from sam@freebsd.org)
Message-ID: <48F4C26B.7060109@freebsd.org>
Date: Tue, 14 Oct 2008 09:01:47 -0700
From: Sam Leffler 
Organization: FreeBSD Project
User-Agent: Thunderbird 2.0.0.9 (X11/20071125)
MIME-Version: 1.0
To: Rafal Jaworowski 
References: <200810140818.m9E8IRLX099905@svn.freebsd.org>
In-Reply-To: <200810140818.m9E8IRLX099905@svn.freebsd.org>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-DCC--Metrics: ebb.errno.com; whitelist
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r183873 - head/sys/arm/conf
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 14 Oct 2008 16:13:40 -0000

Rafal Jaworowski wrote:
> Author: raj
> Date: Tue Oct 14 08:18:27 2008
> New Revision: 183873
> URL: http://svn.freebsd.org/changeset/base/183873
>
> Log:
>   Add kernel config files for Marvell development boards.
>   
>   FreeBSD 8-CURRENT was tested and run successfully on the following eval
>   boards and devices :
>   
>     * DB-88F5182, DB-88F5281 (Orion based)
>   
>     * DB-88F6281, RD-88F6281 (Kirkwood based)
>   
>     * DB-78100 (Discovery based)
>   
>   For more detailed info on build instructions and other examples please refer
>   to http://wiki.freebsd.org/FreeBSDMarvell
>   
Some of these boards/SoC's are bi-endian can you note which byte 
order(s) have been tested?  Thanks.

    Sam


From owner-svn-src-head@FreeBSD.ORG  Tue Oct 14 16:27:52 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DCB401065688;
	Tue, 14 Oct 2008 16:27:52 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CA7598FC1D;
	Tue, 14 Oct 2008 16:27:52 +0000 (UTC) (envelope-from sam@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9EGRqWU010888;
	Tue, 14 Oct 2008 16:27:52 GMT (envelope-from sam@svn.freebsd.org)
Received: (from sam@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9EGRqhN010887;
	Tue, 14 Oct 2008 16:27:52 GMT (envelope-from sam@svn.freebsd.org)
Message-Id: <200810141627.m9EGRqhN010887@svn.freebsd.org>
From: Sam Leffler 
Date: Tue, 14 Oct 2008 16:27:52 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183886 - head/sys/arm/xscale/ixp425
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 14 Oct 2008 16:27:53 -0000

Author: sam
Date: Tue Oct 14 16:27:52 2008
New Revision: 183886
URL: http://svn.freebsd.org/changeset/base/183886

Log:
  correct sizeof calculation
  
  PR:		arm/128095
  Submitted by:	Henning Petersen
  MFC after:	1 week

Modified:
  head/sys/arm/xscale/ixp425/if_npe.c

Modified: head/sys/arm/xscale/ixp425/if_npe.c
==============================================================================
--- head/sys/arm/xscale/ixp425/if_npe.c	Tue Oct 14 15:30:17 2008	(r183885)
+++ head/sys/arm/xscale/ixp425/if_npe.c	Tue Oct 14 16:27:52 2008	(r183886)
@@ -448,7 +448,7 @@ npe_dma_setup(struct npe_softc *sc, stru
 {
 	int error, i;
 
-	memset(dma, 0, sizeof(dma));
+	memset(dma, 0, sizeof(*dma));
 
 	dma->name = name;
 	dma->nbuf = nbuf;

From owner-svn-src-head@FreeBSD.ORG  Tue Oct 14 16:30:07 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E3F801065742;
	Tue, 14 Oct 2008 16:30:07 +0000 (UTC)
	(envelope-from raj@semihalf.com)
Received: from semihalf.com (semihalf.com [206.130.101.55])
	by mx1.freebsd.org (Postfix) with ESMTP id A9D8E8FC1C;
	Tue, 14 Oct 2008 16:30:07 +0000 (UTC)
	(envelope-from raj@semihalf.com)
Received: from mail.semihalf.com (mail.semihalf.com [83.15.139.206])
	by semihalf.com (8.13.1/8.13.1) with ESMTP id m9EG93Ve003241;
	Tue, 14 Oct 2008 10:09:04 -0600
Message-ID: <48F4C41D.90603@semihalf.com>
Date: Tue, 14 Oct 2008 18:09:01 +0200
From: Rafal Jaworowski 
Organization: Semihalf
MIME-Version: 1.0
To: Sam Leffler 
References: <200810140818.m9E8IRLX099905@svn.freebsd.org>
	<48F4C26B.7060109@freebsd.org>
In-Reply-To: <48F4C26B.7060109@freebsd.org>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r183873 - head/sys/arm/conf
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 14 Oct 2008 16:30:08 -0000

Sam Leffler wrote:
> Rafal Jaworowski wrote:
>> Author: raj
>> Date: Tue Oct 14 08:18:27 2008
>> New Revision: 183873
>> URL: http://svn.freebsd.org/changeset/base/183873
>>
>> Log:
>>   Add kernel config files for Marvell development boards.
>>     FreeBSD 8-CURRENT was tested and run successfully on the following
>> eval
>>   boards and devices :
>>       * DB-88F5182, DB-88F5281 (Orion based)
>>       * DB-88F6281, RD-88F6281 (Kirkwood based)
>>       * DB-78100 (Discovery based)
>>     For more detailed info on build instructions and other examples
>> please refer
>>   to http://wiki.freebsd.org/FreeBSDMarvell
>>   
> Some of these boards/SoC's are bi-endian can you note which byte
> order(s) have been tested?  Thanks.

Good point. Only LE mode has been tested so far. I'll add a note about this on
the wiki page.

Rafal

From owner-svn-src-head@FreeBSD.ORG  Tue Oct 14 17:47:29 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AC64A1065693;
	Tue, 14 Oct 2008 17:47:29 +0000 (UTC)
	(envelope-from maxim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 99CE98FC08;
	Tue, 14 Oct 2008 17:47:29 +0000 (UTC)
	(envelope-from maxim@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9EHlTng012292;
	Tue, 14 Oct 2008 17:47:29 GMT (envelope-from maxim@svn.freebsd.org)
Received: (from maxim@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9EHlTWi012291;
	Tue, 14 Oct 2008 17:47:29 GMT (envelope-from maxim@svn.freebsd.org)
Message-Id: <200810141747.m9EHlTWi012291@svn.freebsd.org>
From: Maxim Konovalov 
Date: Tue, 14 Oct 2008 17:47:29 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183887 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 14 Oct 2008 17:47:29 -0000

Author: maxim
Date: Tue Oct 14 17:47:29 2008
New Revision: 183887
URL: http://svn.freebsd.org/changeset/base/183887

Log:
  o Remove unnecessary parentheses and restore identation.
  
  Prodded by:	mlaier

Modified:
  head/sys/netinet/ip_fw2.c

Modified: head/sys/netinet/ip_fw2.c
==============================================================================
--- head/sys/netinet/ip_fw2.c	Tue Oct 14 16:27:52 2008	(r183886)
+++ head/sys/netinet/ip_fw2.c	Tue Oct 14 17:47:29 2008	(r183887)
@@ -4385,50 +4385,42 @@ ipfw_ctl(struct sockopt *sopt)
 		break;
 
 	case IP_FW_NAT_CFG:
-		{
-			if (IPFW_NAT_LOADED)
-				error = ipfw_nat_cfg_ptr(sopt);
-			else {
-				printf("IP_FW_NAT_CFG: %s\n",
-				    "ipfw_nat not present, please load it");
-				error = EINVAL;
-			}
+		if (IPFW_NAT_LOADED)
+			error = ipfw_nat_cfg_ptr(sopt);
+		else {
+			printf("IP_FW_NAT_CFG: %s\n",
+			    "ipfw_nat not present, please load it");
+			error = EINVAL;
 		}
 		break;
 
 	case IP_FW_NAT_DEL:
-		{
-			if (IPFW_NAT_LOADED)
-				error = ipfw_nat_del_ptr(sopt);
-			else {
-				printf("IP_FW_NAT_DEL: %s\n",
-				    "ipfw_nat not present, please load it");
-				error = EINVAL;
-			}
+		if (IPFW_NAT_LOADED)
+			error = ipfw_nat_del_ptr(sopt);
+		else {
+			printf("IP_FW_NAT_DEL: %s\n",
+			    "ipfw_nat not present, please load it");
+			error = EINVAL;
 		}
 		break;
 
 	case IP_FW_NAT_GET_CONFIG:
-		{
-			if (IPFW_NAT_LOADED)
-				error = ipfw_nat_get_cfg_ptr(sopt);
-			else {
-				printf("IP_FW_NAT_GET_CFG: %s\n",
-				    "ipfw_nat not present, please load it");
-				error = EINVAL;
-			}
+		if (IPFW_NAT_LOADED)
+			error = ipfw_nat_get_cfg_ptr(sopt);
+		else {
+			printf("IP_FW_NAT_GET_CFG: %s\n",
+			    "ipfw_nat not present, please load it");
+			error = EINVAL;
 		}
 		break;
 
 	case IP_FW_NAT_GET_LOG:
-		{
-			if (IPFW_NAT_LOADED)
-				error = ipfw_nat_get_log_ptr(sopt);
-			else {
-				printf("IP_FW_NAT_GET_LOG: %s\n",
-				    "ipfw_nat not present, please load it");
-				error = EINVAL;
-			}
+		if (IPFW_NAT_LOADED)
+			error = ipfw_nat_get_log_ptr(sopt);
+		else {
+			printf("IP_FW_NAT_GET_LOG: %s\n",
+			    "ipfw_nat not present, please load it");
+			error = EINVAL;
 		}
 		break;
 

From owner-svn-src-head@FreeBSD.ORG  Tue Oct 14 17:48:36 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AEED61065688;
	Tue, 14 Oct 2008 17:48:36 +0000 (UTC)
	(envelope-from dumbbell@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9B22B8FC18;
	Tue, 14 Oct 2008 17:48:36 +0000 (UTC)
	(envelope-from dumbbell@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9EHmao8012355;
	Tue, 14 Oct 2008 17:48:36 GMT
	(envelope-from dumbbell@svn.freebsd.org)
Received: (from dumbbell@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9EHma9d012354;
	Tue, 14 Oct 2008 17:48:36 GMT
	(envelope-from dumbbell@svn.freebsd.org)
Message-Id: <200810141748.m9EHma9d012354@svn.freebsd.org>
From: Jean-Sebastien Pedron 
Date: Tue, 14 Oct 2008 17:48:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183888 - head/sys/dev/atkbdc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 14 Oct 2008 17:48:36 -0000

Author: dumbbell
Date: Tue Oct 14 17:48:36 2008
New Revision: 183888
URL: http://svn.freebsd.org/changeset/base/183888

Log:
  Rewrite Synaptics touchpads support with the following goals in mind:
      o  better quality of the movement smoothing
      o  more features such as tap-hold and virtual scrolling
  
  Support must still be enabled with this line in your /boot/loader.conf:
      hw.psm.synaptics_support="1"
  
  The following sysctls were removed:
      hw.psm.synaptics.low_speed_threshold
      hw.psm.synaptics.min_movement
      hw.psm.synaptics.squelch_level
  
  An overview of this new driver and a short documentation about the added
  sysctls is available on the wiki:
  http://wiki.freebsd.org/SynapticsTouchpad

Modified:
  head/sys/dev/atkbdc/psm.c

Modified: head/sys/dev/atkbdc/psm.c
==============================================================================
--- head/sys/dev/atkbdc/psm.c	Tue Oct 14 17:47:29 2008	(r183887)
+++ head/sys/dev/atkbdc/psm.c	Tue Oct 14 17:48:36 2008	(r183888)
@@ -163,15 +163,101 @@ typedef struct packetbuf {
 #define	PSM_PACKETQUEUE	128
 #endif
 
+enum {
+	SYNAPTICS_SYSCTL_MIN_PRESSURE,
+	SYNAPTICS_SYSCTL_MAX_PRESSURE,
+	SYNAPTICS_SYSCTL_MAX_WIDTH,
+	SYNAPTICS_SYSCTL_MARGIN_TOP,
+	SYNAPTICS_SYSCTL_MARGIN_RIGHT,
+	SYNAPTICS_SYSCTL_MARGIN_BOTTOM,
+	SYNAPTICS_SYSCTL_MARGIN_LEFT,
+	SYNAPTICS_SYSCTL_NA_TOP,
+	SYNAPTICS_SYSCTL_NA_RIGHT,
+	SYNAPTICS_SYSCTL_NA_BOTTOM,
+	SYNAPTICS_SYSCTL_NA_LEFT,
+	SYNAPTICS_SYSCTL_WINDOW_MIN,
+	SYNAPTICS_SYSCTL_WINDOW_MAX,
+	SYNAPTICS_SYSCTL_MULTIPLICATOR,
+	SYNAPTICS_SYSCTL_WEIGHT_CURRENT,
+	SYNAPTICS_SYSCTL_WEIGHT_PREVIOUS,
+	SYNAPTICS_SYSCTL_WEIGHT_PREVIOUS_NA,
+	SYNAPTICS_SYSCTL_WEIGHT_LEN_SQUARED,
+	SYNAPTICS_SYSCTL_DIV_MIN,
+	SYNAPTICS_SYSCTL_DIV_MAX,
+	SYNAPTICS_SYSCTL_DIV_MAX_NA,
+	SYNAPTICS_SYSCTL_DIV_LEN,
+	SYNAPTICS_SYSCTL_TAP_MAX_DELTA,
+	SYNAPTICS_SYSCTL_TAP_MIN_QUEUE,
+	SYNAPTICS_SYSCTL_TAPHOLD_TIMEOUT,
+	SYNAPTICS_SYSCTL_VSCROLL_HOR_AREA,
+	SYNAPTICS_SYSCTL_VSCROLL_VER_AREA,
+	SYNAPTICS_SYSCTL_VSCROLL_MIN_DELTA,
+	SYNAPTICS_SYSCTL_VSCROLL_DIV_MIN,
+	SYNAPTICS_SYSCTL_VSCROLL_DIV_MAX
+};
+
 typedef struct synapticsinfo {
-	struct sysctl_ctx_list	sysctl_ctx;
+	struct sysctl_ctx_list	 sysctl_ctx;
 	struct sysctl_oid	*sysctl_tree;
-	int			directional_scrolls;
-	int			low_speed_threshold;
-	int			min_movement;
-	int			squelch_level;
+	int			 directional_scrolls;
+	int			 min_pressure;
+	int			 max_pressure;
+	int			 max_width;
+	int			 margin_top;
+	int			 margin_right;
+	int			 margin_bottom;
+	int			 margin_left;
+	int			 na_top;
+	int			 na_right;
+	int			 na_bottom;
+	int			 na_left;
+	int			 window_min;
+	int			 window_max;
+	int			 multiplicator;
+	int			 weight_current;
+	int			 weight_previous;
+	int			 weight_previous_na;
+	int			 weight_len_squared;
+	int			 div_min;
+	int			 div_max;
+	int			 div_max_na;
+	int			 div_len;
+	int			 tap_max_delta;
+	int			 tap_min_queue;
+	int			 taphold_timeout;
+	int			 vscroll_ver_area;
+	int			 vscroll_hor_area;
+	int			 vscroll_min_delta;
+	int			 vscroll_div_min;
+	int			 vscroll_div_max;
 } synapticsinfo_t;
 
+typedef struct synapticspacket {
+	int			x;
+	int			y;
+} synapticspacket_t;
+
+#define	SYNAPTICS_PACKETQUEUE 10
+#define SYNAPTICS_QUEUE_CURSOR(x)					\
+	(x + SYNAPTICS_PACKETQUEUE) % SYNAPTICS_PACKETQUEUE
+
+typedef struct synapticsaction {
+	synapticspacket_t	queue[SYNAPTICS_PACKETQUEUE];
+	int			queue_len;
+	int			queue_cursor;
+	int			window_min;
+	int			start_x;
+	int			start_y;
+	int			avg_dx;
+	int			avg_dy;
+	int			squelch_x;
+	int			squelch_y;
+	int			fingers_nb;
+	int			tap_button;
+	int			in_taphold;
+	int			in_vscroll;
+} synapticsaction_t;
+
 /* driver control block */
 struct psm_softc {		/* Driver status information */
 	int		unit;
@@ -185,6 +271,7 @@ struct psm_softc {		/* Driver status inf
 	mousehw_t	hw;		/* hardware information */
 	synapticshw_t	synhw;		/* Synaptics hardware information */
 	synapticsinfo_t	syninfo;	/* Synaptics configuration */
+	synapticsaction_t synaction;	/* Synaptics action context */
 	mousemode_t	mode;		/* operation mode */
 	mousemode_t	dflt_mode;	/* default operation mode */
 	mousestatus_t	status;		/* accumulated mouse movement */
@@ -781,6 +868,35 @@ doopen(struct psm_softc *sc, int command
 {
 	int stat[3];
 
+	/*
+	 * FIXME: Synaptics TouchPad seems to go back to Relative Mode with
+	 * no obvious reason. Thus we check the current mode and restore the
+	 * Absolute Mode if it was cleared.
+	 *
+	 * The previous hack at the end of psmprobe() wasn't efficient when
+	 * moused(8) was restarted.
+	 *
+	 * A Reset (FF) or Set Defaults (F6) command would clear the
+	 * Absolute Mode bit. But a verbose boot or debug.psm.loglevel=5
+	 * doesn't show any evidence of such a command.
+	 */
+	if (sc->hw.model == MOUSE_MODEL_SYNAPTICS) {
+		mouse_ext_command(sc->kbdc, 1);
+		get_mouse_status(sc->kbdc, stat, 0, 3);
+		if (stat[1] == 0x47 && stat[2] == 0x40) {
+			/* Set the mode byte -- request wmode where
+			 * available */
+			if (sc->synhw.capExtended)
+				mouse_ext_command(sc->kbdc, 0xc1);
+			else
+				mouse_ext_command(sc->kbdc, 0xc0);
+			set_mouse_sampling_rate(sc->kbdc, 20);
+			VLOG(5, (LOG_DEBUG, "psm%d: Synaptis Absolute Mode "
+			    "hopefully restored\n",
+			    sc->unit));
+		}
+	}
+
 	/* enable the mouse device */
 	if (!enable_aux_dev(sc->kbdc)) {
 		/* MOUSE ERROR: failed to enable the mouse because:
@@ -1272,15 +1388,6 @@ psmprobe(device_t dev)
 		endprobe(ENXIO);
 	}
 
-	/*
-	 * Synaptics TouchPad seems to go back to Relative Mode after
-	 * the previous set_controller_command_byte() call; by issueing
-	 * a Read Mode Byte command, the touchpad is in Absolute Mode
-	 * again.
-	 */
-	if (sc->hw.model == MOUSE_MODEL_SYNAPTICS)
-		mouse_ext_command(sc->kbdc, 1);
-
 	/* done */
 	kbdc_set_device_mask(sc->kbdc, mask | KBD_AUX_CONTROL_BITS);
 	kbdc_lock(sc->kbdc, FALSE);
@@ -2398,7 +2505,7 @@ proc_synaptics(struct psm_softc *sc, pac
 {
 	static int touchpad_buttons;
 	static int guest_buttons;
-	int w, x0, y0, xavg, yavg, xsensitivity, ysensitivity, sensitivity = 0;
+	int w, x0, y0;
 
 	/* TouchPad PS/2 absolute mode message format
 	 *
@@ -2418,7 +2525,7 @@ proc_synaptics(struct psm_softc *sc, pac
 	 *  U: up button
 	 *  W: "wrist" value
 	 *  X: x position
-	 *  Y: x position
+	 *  Y: y position
 	 *  Z: pressure
 	 *
 	 * Absolute reportable limits:    0 - 6143.
@@ -2438,22 +2545,44 @@ proc_synaptics(struct psm_softc *sc, pac
 	    (pb->ipacket[3] & 0xc8) != 0xc0)
 		return (-1);
 
-	*x = *y = x0 = y0 = 0;
+	*x = *y = 0;
 
-	/* Pressure value. */
+	/*
+	 * Pressure value.
+	 * Interpretation:
+	 *   z = 0      No finger contact
+	 *   z = 10     Finger hovering near the pad
+	 *   z = 30     Very light finger contact
+	 *   z = 80     Normal finger contact
+	 *   z = 110    Very heavy finger contact
+	 *   z = 200    Finger lying flat on pad surface
+	 *   z = 255    Maximum reportable Z
+	 */
 	*z = pb->ipacket[2];
 
-	/* Finger width value */
+	/*
+	 * Finger width value
+	 * Interpretation:
+	 *   w = 0      Two finger on the pad (capMultiFinger needed)
+	 *   w = 1      Three or more fingers (capMultiFinger needed)
+	 *   w = 2      Pen (instead of finger) (capPen needed)
+	 *   w = 3      Reserved (passthrough?)
+	 *   w = 4-7    Finger of normal width (capPalmDetect needed)
+	 *   w = 8-14   Very wide finger or palm (capPalmDetect needed)
+	 *   w = 15     Maximum reportable width (capPalmDetect needed)
+	 */
+	/* XXX Is checking capExtended enough? */
 	if (sc->synhw.capExtended)
 		w = ((pb->ipacket[0] & 0x30) >> 2) |
 		    ((pb->ipacket[0] & 0x04) >> 1) |
 		    ((pb->ipacket[3] & 0x04) >> 2);
 	else {
-		/* Assume a finger of regular width */
+		/* Assume a finger of regular width. */
 		w = 4;
 	}
 
 	/* Handle packets from the guest device */
+	/* XXX Documentation? */
 	if (w == 3 && sc->synhw.capPassthrough) {
 		*x = ((pb->ipacket[1] & 0x10) ?
 		    pb->ipacket[4] - 256 : pb->ipacket[4]);
@@ -2470,7 +2599,7 @@ proc_synaptics(struct psm_softc *sc, pac
 			guest_buttons |= MOUSE_BUTTON3DOWN;
 
 		ms->button = touchpad_buttons | guest_buttons;
-		return (0);
+		goto SYNAPTICS_END;
 	}
 
 	/* Button presses */
@@ -2492,6 +2621,7 @@ proc_synaptics(struct psm_softc *sc, pac
 	 * the packet indicates that we have an extended
 	 * button press.
 	 */
+	/* XXX Documentation? */
 	if (pb->ipacket[3] & 0x02) {
 		/*
 		 * if directional_scrolls is not 1, we treat any of
@@ -2507,151 +2637,495 @@ proc_synaptics(struct psm_softc *sc, pac
 			if (pb->ipacket[5] & 0x02)
 				touchpad_buttons |= MOUSE_BUTTON7DOWN;
 		} else {
-			if ((pb->ipacket[4] & 0x0F) || (pb->ipacket[5] & 0x0F))
+			if ((pb->ipacket[4] & 0x0F) ||
+			    (pb->ipacket[5] & 0x0F))
 				touchpad_buttons |= MOUSE_BUTTON2DOWN;
 		}
 	}
 
 	ms->button = touchpad_buttons | guest_buttons;
 
-	/* There is a finger on the pad. */
-	if ((w >= 4 && w <= 7) && (*z >= 16 && *z < 200)) {
+	/* Check pressure to detect a real wanted action on the
+	 * touchpad. */
+	if (*z >= sc->syninfo.min_pressure) {
+		synapticsaction_t *synaction;
+		int cursor, peer, window;
+		int dx, dy, dxp, dyp;
+		int max_width, max_pressure;
+		int margin_top, margin_right, margin_bottom, margin_left;
+		int na_top, na_right, na_bottom, na_left;
+		int window_min, window_max;
+		int multiplicator;
+		int weight_current, weight_previous, weight_len_squared;
+		int div_min, div_max, div_len;
+		int vscroll_hor_area, vscroll_ver_area;
+
+		int len, weight_prev_x, weight_prev_y;
+		int div_max_x, div_max_y, div_x, div_y;
+
+		/* Read sysctl. */
+		/* XXX Verify values? */
+		max_width = sc->syninfo.max_width;
+		max_pressure = sc->syninfo.max_pressure;
+		margin_top = sc->syninfo.margin_top;
+		margin_right = sc->syninfo.margin_right;
+		margin_bottom = sc->syninfo.margin_bottom;
+		margin_left = sc->syninfo.margin_left;
+		na_top = sc->syninfo.na_top;
+		na_right = sc->syninfo.na_right;
+		na_bottom = sc->syninfo.na_bottom;
+		na_left = sc->syninfo.na_left;
+		window_min = sc->syninfo.window_min;
+		window_max = sc->syninfo.window_max;
+		multiplicator = sc->syninfo.multiplicator;
+		weight_current = sc->syninfo.weight_current;
+		weight_previous = sc->syninfo.weight_previous;
+		weight_len_squared = sc->syninfo.weight_len_squared;
+		div_min = sc->syninfo.div_min;
+		div_max = sc->syninfo.div_max;
+		div_len = sc->syninfo.div_len;
+		vscroll_hor_area = sc->syninfo.vscroll_hor_area;
+		vscroll_ver_area = sc->syninfo.vscroll_ver_area;
+
+		/* Palm detection. */
+		if (!(
+		    (sc->synhw.capMultiFinger && (w == 0 || w == 1)) ||
+		    (sc->synhw.capPalmDetect && w >= 4 && w <= max_width) ||
+		    (!sc->synhw.capPalmDetect && *z <= max_pressure) ||
+		    (sc->synhw.capPen && w == 2))) {
+			/*
+			 * We consider the packet irrelevant for the current
+			 * action when:
+			 *  - the width isn't comprised in:
+			 *    [4; max_width]
+			 *  - the pressure isn't comprised in:
+			 *    [min_pressure; max_pressure]
+			 *  - pen aren't supported but w is 2
+			 *
+			 *  Note that this doesn't terminate the current action.
+			 */
+			VLOG(2, (LOG_DEBUG,
+			    "synaptics: palm detected! (%d)\n", w));
+			goto SYNAPTICS_END;
+		}
+
+		/* Read current absolute position. */
 		x0 = ((pb->ipacket[3] & 0x10) << 8) |
-		    ((pb->ipacket[1] & 0x0f) << 8) | pb->ipacket[4];
+		    ((pb->ipacket[1] & 0x0f) << 8) |
+		    pb->ipacket[4];
 		y0 = ((pb->ipacket[3] & 0x20) << 7) |
-		    ((pb->ipacket[1] & 0xf0) << 4) | pb->ipacket[5];
+		    ((pb->ipacket[1] & 0xf0) << 4) |
+		    pb->ipacket[5];
 
-		if (sc->flags & PSM_FLAGS_FINGERDOWN) {
-			*x = x0 - sc->xold;
-			*y = y0 - sc->yold;
+		synaction = &(sc->synaction);
 
-			/*
-			 * we compute averages of x and y
-			 * movement
-			 */
-			if (sc->xaverage == 0)
-				sc->xaverage = *x;
+		/*
+		 * If the action is just beginning, init the structure and
+		 * compute tap timeout.
+		 */
+		if (!(sc->flags & PSM_FLAGS_FINGERDOWN)) {
+			VLOG(3, (LOG_DEBUG, "synaptics: ----\n"));
 
-			if (sc->yaverage == 0)
-				sc->yaverage = *y;
+			/* Store the first point of this action. */
+			synaction->start_x = x0;
+			synaction->start_y = y0;
+			dx = dy = 0;
+
+			/* Initialize queue. */
+			synaction->queue_cursor = SYNAPTICS_PACKETQUEUE;
+			synaction->queue_len = 0;
+			synaction->window_min = window_min;
+
+			/* Reset average. */
+			synaction->avg_dx = 0;
+			synaction->avg_dy = 0;
+
+			/* Reset squelch. */
+			synaction->squelch_x = 0;
+			synaction->squelch_y = 0;
+
+			/* Reset pressure peak. */
+			sc->zmax = 0;
+
+			/* Reset fingers count. */
+			synaction->fingers_nb = 0;
+
+			/* Reset virtual scrolling state. */
+			synaction->in_vscroll = 0;
+
+			/* Compute tap timeout. */
+			sc->taptimeout.tv_sec  = tap_timeout / 1000000;
+			sc->taptimeout.tv_usec = tap_timeout % 1000000;
+			timevaladd(&sc->taptimeout, &sc->lastsoftintr);
 
-			xavg = sc->xaverage;
-			yavg = sc->yaverage;
+			sc->flags |= PSM_FLAGS_FINGERDOWN;
+		} else {
+			/* Calculate the current delta. */
+			cursor = synaction->queue_cursor;
+			dx = x0 - synaction->queue[cursor].x;
+			dy = y0 - synaction->queue[cursor].y;
+		}
 
-			sc->xaverage = (xavg + *x) >> 1;
-			sc->yaverage = (yavg + *y) >> 1;
+		/* If in tap-hold, add the recorded button. */
+		if (synaction->in_taphold)
+			ms->button |= synaction->tap_button;
 
-			/*
-			 * then use the averages to compute
-			 * a sensitivity level in each dimension
-			 */
-			xsensitivity = (sc->xaverage - xavg);
-			if (xsensitivity < 0)
-				xsensitivity = -xsensitivity;
-
-			ysensitivity = (sc->yaverage - yavg);
-			if (ysensitivity < 0)
-				ysensitivity = -ysensitivity;
+		/*
+		 * From now on, we can use the SYNAPTICS_END label to skip
+		 * the current packet.
+		 */
+
+		/*
+		 * Limit the coordinates to the specified margins because
+		 * this area isn't very reliable.
+		 */
+		if (x0 <= margin_left)
+			x0 = margin_left;
+		else if (x0 >= 6143 - margin_right)
+			x0 = 6143 - margin_right;
+		if (y0 <= margin_bottom)
+			y0 = margin_bottom;
+		else if (y0 >= 6143 - margin_top)
+			y0 = 6143 - margin_top;
+
+		VLOG(3, (LOG_DEBUG, "synaptics: ipacket: [%d, %d], %d, %d\n",
+		    x0, y0, *z, w));
+
+		/* Queue this new packet. */
+		cursor = SYNAPTICS_QUEUE_CURSOR(synaction->queue_cursor - 1);
+		synaction->queue[cursor].x = x0;
+		synaction->queue[cursor].y = y0;
+		synaction->queue_cursor = cursor;
+		if (synaction->queue_len < SYNAPTICS_PACKETQUEUE)
+			synaction->queue_len++;
+		VLOG(5, (LOG_DEBUG,
+		    "synaptics: cursor[%d]: x=%d, y=%d, dx=%d, dy=%d\n",
+		    cursor, x0, y0, dx, dy));
 
+		/*
+		 * For tap, we keep the maximum number of fingers and the
+		 * pressure peak. Also with multiple fingers, we increase
+		 * the minimum window.
+		 */
+		switch (w) {
+		case 1: /* Three or more fingers. */
+			synaction->fingers_nb = imax(3, synaction->fingers_nb);
+			synaction->window_min = window_max;
+			break;
+		case 0: /* Two fingers. */
+			synaction->fingers_nb = imax(2, synaction->fingers_nb);
+			synaction->window_min = window_max;
+			break;
+		default: /* One finger or undetectable. */
+			synaction->fingers_nb = imax(1, synaction->fingers_nb);
+		}
+		sc->zmax = imax(*z, sc->zmax);
+
+		/* Do we have enough packets to consider this a movement? */
+		if (synaction->queue_len < synaction->window_min)
+			goto SYNAPTICS_END;
+
+		/* Is a scrolling action occuring? */
+		if (!synaction->in_taphold && !synaction->in_vscroll) {
 			/*
-			 * The sensitivity level is higher the faster
-			 * the finger is moving.  It also tends to be
-			 * higher in the middle of a touchpad motion
-			 * than on either end
-			 * Note - sensitivity gets to 0 when moving slowly -
-			 * so we add 1 to it to give it a meaningful value
-			 * in that case.
+			 * A scrolling action must not conflict with a tap
+			 * action. Here are the conditions to consider a
+			 * scrolling action:
+			 *  - the action in a configurable area
+			 *  - one of the following:
+			 *     . the distance between the last packet and the
+			 *       first should be above a configurable minimum
+			 *     . tap timed out
 			 */
-			sensitivity = (xsensitivity & ysensitivity) + 1;
+			dxp = abs(synaction->queue[synaction->queue_cursor].x -
+			    synaction->start_x);
+			dyp = abs(synaction->queue[synaction->queue_cursor].y -
+			    synaction->start_y);
+
+			if (timevalcmp(&sc->lastsoftintr, &sc->taptimeout, >) ||
+			    dxp >= sc->syninfo.vscroll_min_delta ||
+			    dyp >= sc->syninfo.vscroll_min_delta) {
+				/* Check for horizontal scrolling. */
+				if ((vscroll_hor_area > 0 &&
+				    synaction->start_y <= vscroll_hor_area) ||
+				    (vscroll_hor_area < 0 &&
+				     synaction->start_y >=
+				     6143 + vscroll_hor_area))
+					synaction->in_vscroll += 2;
+
+				/* Check for vertical scrolling. */
+				if ((vscroll_ver_area > 0 &&
+				    synaction->start_x <= vscroll_ver_area) ||
+				    (vscroll_ver_area < 0 &&
+				     synaction->start_x >=
+				     6143 + vscroll_ver_area))
+					synaction->in_vscroll += 1;
+
+				/* Avoid conflicts if area overlaps. */
+				if (synaction->in_vscroll == 3)
+					synaction->in_vscroll =
+					    (dxp > dyp) ? 2 : 1;
+			}
+			VLOG(5, (LOG_DEBUG,
+			    "synaptics: virtual scrolling: %s "
+			    "(direction=%d, dxp=%d, dyp=%d)\n",
+			    synaction->in_vscroll ? "YES" : "NO",
+			    synaction->in_vscroll, dxp, dyp));
+		}
 
+		weight_prev_x = weight_prev_y = weight_previous;
+		div_max_x = div_max_y = div_max;
+
+		if (synaction->in_vscroll) {
+			/* Dividers are different with virtual scrolling. */
+			div_min = sc->syninfo.vscroll_div_min;
+			div_max_x = div_max_y = sc->syninfo.vscroll_div_max;
+		} else {
 			/*
-			 * If either our x or y change is greater than
-			 * our hi/low speed threshold - we do the high-speed
-			 * absolute to relative calculation otherwise
-			 * we do the low-speed calculation.
+			 * There's a lot of noise in coordinates when
+			 * the finger is on the touchpad's borders. When
+			 * using this area, we apply a special weight and
+			 * div.
 			 */
-			if ((*x > sc->syninfo.low_speed_threshold ||
-			    *x < -sc->syninfo.low_speed_threshold) ||
-			    (*y > sc->syninfo.low_speed_threshold ||
-			    *y < -sc->syninfo.low_speed_threshold)) {
-				x0 = (x0 + sc->xold * 3) / 4;
-				y0 = (y0 + sc->yold * 3) / 4;
-				*x = (x0 - sc->xold) * 10 / 85;
-				*y = (y0 - sc->yold) * 10 / 85;
-			} else {
-				/*
-				 * This is the low speed calculation.
-				 * We simply check to see if our movement is
-				 * more than our minimum movement threshold
-				 * and if it is - set the movement to 1
-				 * in the correct direction.
-				 * NOTE - Normally this would result
-				 * in pointer movement that was WAY too fast.
-				 * This works due to the movement squelch
-				 * we do later.
-				 */
-				if (*x < -sc->syninfo.min_movement)
-					*x = -1;
-				else if (*x > sc->syninfo.min_movement)
-					*x = 1;
-				else
-					*x = 0;
-				if (*y < -sc->syninfo.min_movement)
-					*y = -1;
-				else if (*y > sc->syninfo.min_movement)
-					*y = 1;
-				else
-					*y = 0;
+			if (x0 <= na_left || x0 >= 6143 - na_right) {
+				weight_prev_x = sc->syninfo.weight_previous_na;
+				div_max_x = sc->syninfo.div_max_na;
+			}
 
+			if (y0 <= na_bottom || y0 >= 6143 - na_top) {
+				weight_prev_y = sc->syninfo.weight_previous_na;
+				div_max_y = sc->syninfo.div_max_na;
 			}
-		} else
-			sc->flags |= PSM_FLAGS_FINGERDOWN;
+		}
 
 		/*
-		 * The squelch process.  Take our sensitivity value and
-		 * add it to the current squelch value - if squelch is
-		 * less than our squelch threshold we kill the movement,
-		 * otherwise we reset squelch and pass the movement through.
-		 * Since squelch is cumulative - when mouse movement is slow
-		 * (around sensitivity 1) the net result is that only 1
-		 * out of every squelch_level packets is delivered,
-		 * effectively slowing down the movement.
-		 */
-		sc->squelch += sensitivity;
-		if (sc->squelch < sc->syninfo.squelch_level) {
-			*x = 0;
-			*y = 0;
-		} else
-			sc->squelch = 0;
+		 * Calculate weights for the average operands and
+		 * the divisor. Both depend on the distance between
+		 * the current packet and a previous one (based on the
+		 * window width).
+		 */
+		window = imin(synaction->queue_len, window_max);
+		peer = SYNAPTICS_QUEUE_CURSOR(cursor + window - 1);
+		dxp = abs(x0 - synaction->queue[peer].x) + 1;
+		dyp = abs(y0 - synaction->queue[peer].y) + 1;
+		len = (dxp * dxp) + (dyp * dyp);
+		weight_prev_x = imin(weight_prev_x,
+		    weight_len_squared * weight_prev_x / len);
+		weight_prev_y = imin(weight_prev_y,
+		    weight_len_squared * weight_prev_y / len);
+
+		len = (dxp + dyp) / 2;
+		div_x = div_len * div_max_x / len;
+		div_x = imin(div_max_x, div_x);
+		div_x = imax(div_min, div_x);
+		div_y = div_len * div_max_y / len;
+		div_y = imin(div_max_y, div_y);
+		div_y = imax(div_min, div_y);
+
+		VLOG(3, (LOG_DEBUG,
+		    "synaptics: peer=%d, len=%d, weight=%d/%d, div=%d/%d\n",
+		    peer, len, weight_prev_x, weight_prev_y, div_x, div_y));
+
+		/* Compute averages. */
+		synaction->avg_dx =
+		    (weight_current * dx * multiplicator +
+		     weight_prev_x * synaction->avg_dx) /
+		    (weight_current + weight_prev_x);
+
+		synaction->avg_dy =
+		    (weight_current * dy * multiplicator +
+		     weight_prev_y * synaction->avg_dy) /
+		    (weight_current + weight_prev_y);
+
+		VLOG(5, (LOG_DEBUG,
+		    "synaptics: avg_dx~=%d, avg_dy~=%d\n",
+		    synaction->avg_dx / multiplicator,
+		    synaction->avg_dy / multiplicator));
+
+		/* Use these averages to calculate x & y. */
+		synaction->squelch_x += synaction->avg_dx;
+		*x = synaction->squelch_x / (div_x * multiplicator);
+		synaction->squelch_x = synaction->squelch_x %
+		    (div_x * multiplicator);
+
+		synaction->squelch_y += synaction->avg_dy;
+		*y = synaction->squelch_y / (div_y * multiplicator);
+		synaction->squelch_y = synaction->squelch_y %
+		    (div_y * multiplicator);
+
+		if (synaction->in_vscroll) {
+			switch(synaction->in_vscroll) {
+			case 1: /* Vertical scrolling. */
+				if (*y != 0)
+					ms->button |= (*y > 0) ?
+					    MOUSE_BUTTON4DOWN :
+					    MOUSE_BUTTON5DOWN;
+				break;
+			case 2: /* Horizontal scrolling. */
+				if (*x != 0)
+					ms->button |= (*x > 0) ?
+					    MOUSE_BUTTON7DOWN :
+					    MOUSE_BUTTON6DOWN;
+				break;
+			}
+
+			/* The pointer is not moved. */
+			*x = *y = 0;
+		} else {
+			VLOG(3, (LOG_DEBUG, "synaptics: [%d, %d] -> [%d, %d]\n",
+			    dx, dy, *x, *y));
+		}
+	} else if (sc->flags & PSM_FLAGS_FINGERDOWN) {
+		/*
+		 * An action is currently taking place but the pressure
+		 * dropped under the minimum, putting an end to it.
+		 */
+		synapticsaction_t *synaction;
+		int taphold_timeout, dx, dy, tap_max_delta;
+
+		synaction = &(sc->synaction);
+		dx = abs(synaction->queue[synaction->queue_cursor].x -
+		    synaction->start_x);
+		dy = abs(synaction->queue[synaction->queue_cursor].y -
+		    synaction->start_y);
+
+		/* Max delta is disabled for multi-fingers tap. */
+		if (synaction->fingers_nb > 1)
+			tap_max_delta = imax(dx, dy);
+		else
+			tap_max_delta = sc->syninfo.tap_max_delta;
 
-		sc->xold = x0;
-		sc->yold = y0;
-		sc->zmax = imax(*z, sc->zmax);
-	} else {
 		sc->flags &= ~PSM_FLAGS_FINGERDOWN;
 
-		if (sc->zmax > tap_threshold &&
-		    timevalcmp(&sc->lastsoftintr, &sc->taptimeout, <=)) {
-			if (w == 0)
-				ms->button |= MOUSE_BUTTON3DOWN;
-			else if (w == 1)
-				ms->button |= MOUSE_BUTTON2DOWN;
-			else
-				ms->button |= MOUSE_BUTTON1DOWN;
-		}
+		/* Check for tap. */
+		VLOG(3, (LOG_DEBUG,
+		    "synaptics: zmax=%d, dx=%d, dy=%d, "
+		    "delta=%d, fingers=%d, queue=%d\n",
+		    sc->zmax, dx, dy, tap_max_delta, synaction->fingers_nb,
+		    synaction->queue_len));
+		if (!synaction->in_vscroll && sc->zmax >= tap_threshold &&
+		    timevalcmp(&sc->lastsoftintr, &sc->taptimeout, <=) &&
+		    dx <= tap_max_delta && dy <= tap_max_delta &&
+		    synaction->queue_len >= sc->syninfo.tap_min_queue) {
+			/*
+			 * We have a tap if:
+			 *   - the maximum pressure went over tap_threshold
+			 *   - the action ended before tap_timeout
+			 *
+			 * To handle tap-hold, we must delay any button push to
+			 * the next action.
+			 */
+			if (synaction->in_taphold) {
+				/*
+				 * This is the second and last tap of a
+				 * double tap action, not a tap-hold.
+				 */
+				synaction->in_taphold = 0;
 
-		sc->zmax = 0;
-		sc->taptimeout.tv_sec = tap_timeout / 1000000;
-		sc->taptimeout.tv_usec = tap_timeout % 1000000;
-		timevaladd(&sc->taptimeout, &sc->lastsoftintr);
+				/*
+				 * For double-tap to work:
+				 *   - no button press is emitted (to
+				 *     simulate a button release)
+				 *   - PSM_FLAGS_FINGERDOWN is set to
+				 *     force the next packet to emit a
+				 *     button press)
+				 */
+				VLOG(2, (LOG_DEBUG,
+				    "synaptics: button RELEASE: %d\n",
+				    synaction->tap_button));
+				sc->flags |= PSM_FLAGS_FINGERDOWN;
+			} else {
+				/*
+				 * This is the first tap: we set the
+				 * tap-hold state and notify the button
+				 * down event.
+				 */
+				synaction->in_taphold = 1;
+				taphold_timeout = sc->syninfo.taphold_timeout;
+				sc->taptimeout.tv_sec  = taphold_timeout /
+				    1000000;
+				sc->taptimeout.tv_usec = taphold_timeout %
+				    1000000;
+				timevaladd(&sc->taptimeout, &sc->lastsoftintr);
+
+				switch (synaction->fingers_nb) {
+				case 3:
+					synaction->tap_button =
+					    MOUSE_BUTTON2DOWN;
+					break;
+				case 2:
+					synaction->tap_button =
+					    MOUSE_BUTTON3DOWN;
+					break;
+				default:
+					synaction->tap_button =
+					    MOUSE_BUTTON1DOWN;
+				}
+				VLOG(2, (LOG_DEBUG,
+				    "synaptics: button PRESS: %d\n",
+				    synaction->tap_button));
+				ms->button |= synaction->tap_button;
+			}
+		} else {
+			/*
+			 * Not enough pressure or timeout: reset
+			 * tap-hold state.
+			 */
+			if (synaction->in_taphold) {
+				VLOG(2, (LOG_DEBUG,
+				    "synaptics: button RELEASE: %d\n",
+				    synaction->tap_button));
+				synaction->in_taphold = 0;
+			} else {
+				VLOG(2, (LOG_DEBUG,
+				    "synaptics: not a tap-hold\n"));
+			}
+		}
+	} else if (!(sc->flags & PSM_FLAGS_FINGERDOWN) &&
+	    sc->synaction.in_taphold) {
+		/*
+		 * For a tap-hold to work, the button must remain down at
+		 * least until timeout (where the in_taphold flags will be
+		 * cleared) or during the next action.
+		 */
+		if (timevalcmp(&sc->lastsoftintr, &sc->taptimeout, <=)) {
+			ms->button |= sc->synaction.tap_button;
+		} else {
+			VLOG(2, (LOG_DEBUG,
+			    "synaptics: button RELEASE: %d\n",
+			    sc->synaction.tap_button));
+			sc->synaction.in_taphold = 0;
+		}
 	}
 
-	/* Use the extra buttons as a scrollwheel */
-	if (ms->button & MOUSE_BUTTON4DOWN)
+SYNAPTICS_END:
+	/*
+	 * Use the extra buttons as a scrollwheel
+	 *
+	 * XXX X.Org uses the Z axis for vertical wheel only,
+	 * whereas moused(8) understands special values to differ
+	 * vertical and horizontal wheels.
+	 *
+	 * xf86-input-mouse needs therefore a small patch to
+	 * understand these special values. Without it, the
+	 * horizontal wheel acts as a vertical wheel in X.Org.
+	 *
+	 * That's why the horizontal wheel is disabled by
+	 * default for now.
+	 */
+	if (ms->button & MOUSE_BUTTON4DOWN) {
 		*z = -1;
-	else if (ms->button & MOUSE_BUTTON5DOWN)
+		ms->button &= ~MOUSE_BUTTON4DOWN;
+	} else if (ms->button & MOUSE_BUTTON5DOWN) {
 		*z = 1;
-	else
+		ms->button &= ~MOUSE_BUTTON5DOWN;
+	} else if (ms->button & MOUSE_BUTTON6DOWN) {
+		*z = -2;
+		ms->button &= ~MOUSE_BUTTON6DOWN;
+	} else if (ms->button & MOUSE_BUTTON7DOWN) {
+		*z = 2;
+		ms->button &= ~MOUSE_BUTTON7DOWN;
+	} else
 		*z = 0;
 
 	return (0);
@@ -3400,13 +3874,87 @@ enable_4dplus(struct psm_softc *sc)
 
 /* Synaptics Touchpad */
 static int
-enable_synaptics(struct psm_softc *sc)
+synaptics_sysctl(SYSCTL_HANDLER_ARGS)
 {
-	int status[3];
-	KBDC kbdc;
+	int error, arg;
 
-	if (!synaptics_support)
-		return (FALSE);
+	/* Read the current value. */
+	arg = *(int *)oidp->oid_arg1;
+	error = sysctl_handle_int(oidp, &arg, 0, req);
+
+	/* Sanity check. */
+	if (error || !req->newptr)
+		return (error);
+
+	/*
+	 * Check that the new value is in the concerned node's range
+	 * of values.
+	 */
+	switch (oidp->oid_arg2) {
+	case SYNAPTICS_SYSCTL_MIN_PRESSURE:
+	case SYNAPTICS_SYSCTL_MAX_PRESSURE:
+		if (arg < 0 || arg > 255)
+			return (EINVAL);
+		break;
+	case SYNAPTICS_SYSCTL_MAX_WIDTH:
+		if (arg < 4 || arg > 15)
+			return (EINVAL);
+		break;
+	case SYNAPTICS_SYSCTL_MARGIN_TOP:
+	case SYNAPTICS_SYSCTL_MARGIN_RIGHT:
+	case SYNAPTICS_SYSCTL_MARGIN_BOTTOM:
+	case SYNAPTICS_SYSCTL_MARGIN_LEFT:
+	case SYNAPTICS_SYSCTL_NA_TOP:
+	case SYNAPTICS_SYSCTL_NA_RIGHT:
+	case SYNAPTICS_SYSCTL_NA_BOTTOM:
+	case SYNAPTICS_SYSCTL_NA_LEFT:
+		if (arg < 0 || arg > 6143)
+			return (EINVAL);
+		break;
+	case SYNAPTICS_SYSCTL_WINDOW_MIN:
+	case SYNAPTICS_SYSCTL_WINDOW_MAX:
+	case SYNAPTICS_SYSCTL_TAP_MIN_QUEUE:
+		if (arg < 1 || arg > SYNAPTICS_PACKETQUEUE)
+			return (EINVAL);
+		break;
+	case SYNAPTICS_SYSCTL_MULTIPLICATOR:
+	case SYNAPTICS_SYSCTL_WEIGHT_CURRENT:
+	case SYNAPTICS_SYSCTL_WEIGHT_PREVIOUS:
+	case SYNAPTICS_SYSCTL_WEIGHT_PREVIOUS_NA:
+	case SYNAPTICS_SYSCTL_WEIGHT_LEN_SQUARED:
+	case SYNAPTICS_SYSCTL_DIV_MIN:
+	case SYNAPTICS_SYSCTL_DIV_MAX:
+	case SYNAPTICS_SYSCTL_DIV_MAX_NA:
+	case SYNAPTICS_SYSCTL_DIV_LEN:
+	case SYNAPTICS_SYSCTL_VSCROLL_DIV_MIN:
+	case SYNAPTICS_SYSCTL_VSCROLL_DIV_MAX:
+		if (arg < 1)
+			return (EINVAL);
+		break;
+	case SYNAPTICS_SYSCTL_TAP_MAX_DELTA:
+	case SYNAPTICS_SYSCTL_TAPHOLD_TIMEOUT:
+	case SYNAPTICS_SYSCTL_VSCROLL_MIN_DELTA:
+		if (arg < 0)
+			return (EINVAL);
+		break;
+	case SYNAPTICS_SYSCTL_VSCROLL_HOR_AREA:
+	case SYNAPTICS_SYSCTL_VSCROLL_VER_AREA:
+		if (arg < -6143 || arg > 6143)
+			return (EINVAL);
+		break;
+	default:
+		return (EINVAL);
+	}
+
+	/* Update. */
+	*(int *)oidp->oid_arg1 = arg;
+
+	return (error);
+}
+
+static void
+synaptics_sysctl_create_tree(struct psm_softc *sc)
+{
 
 	/* Attach extra synaptics sysctl nodes under hw.psm.synaptics */
 	sysctl_ctx_init(&sc->syninfo.sysctl_ctx);
@@ -3414,54 +3962,307 @@ enable_synaptics(struct psm_softc *sc)
 	    SYSCTL_STATIC_CHILDREN(_hw_psm), OID_AUTO, "synaptics", CTLFLAG_RD,
 	    0, "Synaptics TouchPad");
 
-	/*
-	 * synaptics_directional_scrolls - if non-zero, the directional
-	 * pad scrolls, otherwise it registers as a middle-click.
-	 */
+	/* hw.psm.synaptics.directional_scrolls. */
 	sc->syninfo.directional_scrolls = 1;
 	SYSCTL_ADD_INT(&sc->syninfo.sysctl_ctx,
 	    SYSCTL_CHILDREN(sc->syninfo.sysctl_tree), OID_AUTO,
-	    "directional_scrolls", CTLFLAG_RW,
+	    "directional_scrolls", CTLFLAG_RW|CTLFLAG_ANYBODY,
 	    &sc->syninfo.directional_scrolls, 0,
-	    "directional pad scrolls (1=yes  0=3rd button)");
+	    "Enable hardware scrolling pad (if non-zero) or register it as "
+	    "a middle-click (if 0)");
 
-	/*
-	 * Synaptics_low_speed_threshold - the number of touchpad units
-	 * below-which we go into low-speed tracking mode.
-	 */
-	sc->syninfo.low_speed_threshold = 20;
-	SYSCTL_ADD_INT(&sc->syninfo.sysctl_ctx,
+	/* hw.psm.synaptics.min_pressure. */
+	sc->syninfo.min_pressure = 16;
+	SYSCTL_ADD_PROC(&sc->syninfo.sysctl_ctx,
 	    SYSCTL_CHILDREN(sc->syninfo.sysctl_tree), OID_AUTO,
-	    "low_speed_threshold", CTLFLAG_RW,
-	    &sc->syninfo.low_speed_threshold, 0,
-	    "threshold between low and hi speed positioning");
-
-	/*
-	 * Synaptics_min_movement - the number of touchpad units below
-	 * which we ignore altogether.
-	 */
-	sc->syninfo.min_movement = 2;
-	SYSCTL_ADD_INT(&sc->syninfo.sysctl_ctx,
+	    "min_pressure", CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_ANYBODY,
+	    &sc->syninfo.min_pressure, SYNAPTICS_SYSCTL_MIN_PRESSURE,
+	    synaptics_sysctl, "I",
+	    "Minimum pressure required to start an action");
+
+	/* hw.psm.synaptics.max_pressure. */

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-head@FreeBSD.ORG  Tue Oct 14 17:53:27 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 33E90106568A;
	Tue, 14 Oct 2008 17:53:27 +0000 (UTC)
	(envelope-from maxim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2172D8FC16;
	Tue, 14 Oct 2008 17:53:27 +0000 (UTC)
	(envelope-from maxim@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9EHrRuv012476;
	Tue, 14 Oct 2008 17:53:27 GMT (envelope-from maxim@svn.freebsd.org)
Received: (from maxim@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9EHrQUF012474;
	Tue, 14 Oct 2008 17:53:26 GMT (envelope-from maxim@svn.freebsd.org)
Message-Id: <200810141753.m9EHrQUF012474@svn.freebsd.org>
From: Maxim Konovalov 
Date: Tue, 14 Oct 2008 17:53:26 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183889 - head/sbin/ipfw
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 14 Oct 2008 17:53:27 -0000

Author: maxim
Date: Tue Oct 14 17:53:26 2008
New Revision: 183889
URL: http://svn.freebsd.org/changeset/base/183889

Log:
  o Do nothing in show_nat() for a test mode (-n).  This prevents
  show_nat() from endless loop and makes work ipfw -n nat <...>.
  
  PR:		bin/128064
  Submitted by:	sem
  MFC after:	1 month

Modified:
  head/sbin/ipfw/ipfw2.c

Modified: head/sbin/ipfw/ipfw2.c
==============================================================================
--- head/sbin/ipfw/ipfw2.c	Tue Oct 14 17:48:36 2008	(r183888)
+++ head/sbin/ipfw/ipfw2.c	Tue Oct 14 17:53:26 2008	(r183889)
@@ -3856,9 +3856,6 @@ nospace:
 }
 
 static void
-show_nat(int ac, char **av);
-
-static void
 print_nat_config(char *buf) {
 	struct cfg_nat *n;
 	int i, cnt, flag, off;
@@ -4066,11 +4063,6 @@ config_nat(int ac, char **av)
 	i = do_cmd(IP_FW_NAT_CFG, buf, off);
 	if (i)
 		err(1, "setsockopt(%s)", "IP_FW_NAT_CFG");
-
-	/* After every modification, we show the resultant rule. */
-	int _ac = 3;
-	char *_av[] = {"show", "config", id};
-	show_nat(_ac, _av);
 }
 
 static void
@@ -6035,6 +6027,9 @@ show_nat(int ac, char **av)
 	lrule = IPFW_DEFAULT_RULE; /* max ipfw rule number */
 	ac--; av++;
 
+	if (test_only)
+		return;
+
 	/* Parse parameters. */
 	for (cmd = IP_FW_NAT_GET_LOG, do_cfg = 0; ac != 0; ac--, av++) {
 		if (!strncmp(av[0], "config", strlen(av[0]))) {
@@ -6059,6 +6054,7 @@ show_nat(int ac, char **av)
 		if (do_cmd(cmd, data, (uintptr_t)&nbytes) < 0)
 			err(EX_OSERR, "getsockopt(IP_FW_GET_%s)",
 			    (cmd == IP_FW_NAT_GET_LOG) ? "LOG" : "CONFIG");
+		printf("nbytes %b\n", nbytes);
 	}
 	if (nbytes == 0)
 		exit(0);

From owner-svn-src-head@FreeBSD.ORG  Tue Oct 14 17:59:40 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 32A271065678;
	Tue, 14 Oct 2008 17:59:40 +0000 (UTC)
	(envelope-from maxim@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 201768FC26;
	Tue, 14 Oct 2008 17:59:40 +0000 (UTC)
	(envelope-from maxim@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9EHxeBw012626;
	Tue, 14 Oct 2008 17:59:40 GMT (envelope-from maxim@svn.freebsd.org)
Received: (from maxim@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9EHxdhc012624;
	Tue, 14 Oct 2008 17:59:39 GMT (envelope-from maxim@svn.freebsd.org)
Message-Id: <200810141759.m9EHxdhc012624@svn.freebsd.org>
From: Maxim Konovalov 
Date: Tue, 14 Oct 2008 17:59:39 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183890 - head/sbin/ipfw
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 14 Oct 2008 17:59:40 -0000

Author: maxim
Date: Tue Oct 14 17:59:39 2008
New Revision: 183890
URL: http://svn.freebsd.org/changeset/base/183890

Log:
  o Remove a debug code and restore an accidentally deleted code
  in a previous commit.

Modified:
  head/sbin/ipfw/ipfw2.c

Modified: head/sbin/ipfw/ipfw2.c
==============================================================================
--- head/sbin/ipfw/ipfw2.c	Tue Oct 14 17:53:26 2008	(r183889)
+++ head/sbin/ipfw/ipfw2.c	Tue Oct 14 17:59:39 2008	(r183890)
@@ -3856,6 +3856,9 @@ nospace:
 }
 
 static void
+show_nat(int ac, char **av);
+
+static void
 print_nat_config(char *buf) {
 	struct cfg_nat *n;
 	int i, cnt, flag, off;
@@ -4063,6 +4066,11 @@ config_nat(int ac, char **av)
 	i = do_cmd(IP_FW_NAT_CFG, buf, off);
 	if (i)
 		err(1, "setsockopt(%s)", "IP_FW_NAT_CFG");
+
+	/* After every modification, we show the resultant rule. */
+	int _ac = 3;
+	char *_av[] = {"show", "config", id};
+	show_nat(_ac, _av);
 }
 
 static void
@@ -6054,7 +6062,6 @@ show_nat(int ac, char **av)
 		if (do_cmd(cmd, data, (uintptr_t)&nbytes) < 0)
 			err(EX_OSERR, "getsockopt(IP_FW_GET_%s)",
 			    (cmd == IP_FW_NAT_GET_LOG) ? "LOG" : "CONFIG");
-		printf("nbytes %b\n", nbytes);
 	}
 	if (nbytes == 0)
 		exit(0);

From owner-svn-src-head@FreeBSD.ORG  Tue Oct 14 18:24:40 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C548A106569C;
	Tue, 14 Oct 2008 18:24:40 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B31AF8FC17;
	Tue, 14 Oct 2008 18:24:40 +0000 (UTC)
	(envelope-from thompsa@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9EIOedB013105;
	Tue, 14 Oct 2008 18:24:40 GMT (envelope-from thompsa@svn.freebsd.org)
Received: (from thompsa@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9EIOeh5013104;
	Tue, 14 Oct 2008 18:24:40 GMT (envelope-from thompsa@svn.freebsd.org)
Message-Id: <200810141824.m9EIOeh5013104@svn.freebsd.org>
From: Andrew Thompson 
Date: Tue, 14 Oct 2008 18:24:40 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183891 - head/sys/dev/usb
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 14 Oct 2008 18:24:40 -0000

Author: thompsa
Date: Tue Oct 14 18:24:40 2008
New Revision: 183891
URL: http://svn.freebsd.org/changeset/base/183891

Log:
  Remove the 'old' Novatel MC950D entry which was slightly incorrect, NetBSD has
  already picked up the new name so run with it.

Modified:
  head/sys/dev/usb/usbdevs

Modified: head/sys/dev/usb/usbdevs
==============================================================================
--- head/sys/dev/usb/usbdevs	Tue Oct 14 17:59:39 2008	(r183890)
+++ head/sys/dev/usb/usbdevs	Tue Oct 14 18:24:40 2008	(r183891)
@@ -1839,7 +1839,6 @@ product NOVATEL X950D		0x1450	Merlin X95
 product NOVATEL ES620		0x2100	ES620 CDMA
 product NOVATEL U720		0x2110	Merlin U720
 product NOVATEL U727		0x4100	Merlin U727 CDMA
-product NOVATEL U950D		0x4400	Novatel MC950D HSUPA
 product NOVATEL MC950D		0x4400	Novatel MC950D HSUPA
 product NOVATEL ZEROCD		0x5010	Novatel ZeroCD
 product NOVATEL2 FLEXPACKGPS	0x0100	NovAtel FlexPack GPS receiver

From owner-svn-src-head@FreeBSD.ORG  Tue Oct 14 19:58:26 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8BBFE106568B;
	Tue, 14 Oct 2008 19:58:26 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 790578FC18;
	Tue, 14 Oct 2008 19:58:26 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9EJwQu1014892;
	Tue, 14 Oct 2008 19:58:26 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9EJwQqF014891;
	Tue, 14 Oct 2008 19:58:26 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200810141958.m9EJwQqF014891@svn.freebsd.org>
From: Alexander Motin 
Date: Tue, 14 Oct 2008 19:58:26 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183894 - head/sys/dev/sound/pci/hda
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 14 Oct 2008 19:58:26 -0000

Author: mav
Date: Tue Oct 14 19:58:26 2008
New Revision: 183894
URL: http://svn.freebsd.org/changeset/base/183894

Log:
  Add all Sigmatel/IDT codecs I could find.
  Add IDT and Intel unknown codecs.
  
  PR:		kern/125822

Modified:
  head/sys/dev/sound/pci/hda/hdac.c

Modified: head/sys/dev/sound/pci/hda/hdac.c
==============================================================================
--- head/sys/dev/sound/pci/hda/hdac.c	Tue Oct 14 19:48:58 2008	(r183893)
+++ head/sys/dev/sound/pci/hda/hdac.c	Tue Oct 14 19:58:26 2008	(r183894)
@@ -579,15 +579,55 @@ static const struct {
 #define HDA_CODEC_STAC9228D	HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7617)
 #define HDA_CODEC_STAC9227X	HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7618)
 #define HDA_CODEC_STAC9227D	HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7619)
+#define HDA_CODEC_STAC9274	HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7620)
+#define HDA_CODEC_STAC9274D	HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7621)
+#define HDA_CODEC_STAC9273X	HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7622)
+#define HDA_CODEC_STAC9273D	HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7623)
+#define HDA_CODEC_STAC9272X	HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7624)
+#define HDA_CODEC_STAC9272D	HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7625)
+#define HDA_CODEC_STAC9271X	HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7626)
 #define HDA_CODEC_STAC9271D	HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7627)
+#define HDA_CODEC_STAC9274X5NH	HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7628)
+#define HDA_CODEC_STAC9274D5NH	HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7629)
+#define HDA_CODEC_STAC9250	HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7634)
+#define HDA_CODEC_STAC9251	HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7636)
+#define HDA_CODEC_IDT92HD700X	HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7638)
+#define HDA_CODEC_IDT92HD700D	HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7639)
+#define HDA_CODEC_IDT92HD206X	HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7645)
+#define HDA_CODEC_IDT92HD206D	HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7646)
 #define HDA_CODEC_STAC9872AK	HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7662)
 #define HDA_CODEC_STAC9221	HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7680)
 #define HDA_CODEC_STAC922XD	HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7681)
+#define HDA_CODEC_STAC9221_A2	HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7682)
 #define HDA_CODEC_STAC9221D	HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7683)
 #define HDA_CODEC_STAC9220	HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7690)
-#define HDA_CODEC_STAC9205	HDA_CODEC_CONSTRUCT(SIGMATEL, 0x76a0)
+#define HDA_CODEC_STAC9200D	HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7691)
+#define HDA_CODEC_IDT92HD005	HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7698)
+#define HDA_CODEC_IDT92HD005D	HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7699)
+#define HDA_CODEC_STAC9205X	HDA_CODEC_CONSTRUCT(SIGMATEL, 0x76a0)
+#define HDA_CODEC_STAC9205D	HDA_CODEC_CONSTRUCT(SIGMATEL, 0x76a1)
+#define HDA_CODEC_STAC9204X	HDA_CODEC_CONSTRUCT(SIGMATEL, 0x76a2)
+#define HDA_CODEC_STAC9204D	HDA_CODEC_CONSTRUCT(SIGMATEL, 0x76a3)
+#define HDA_CODEC_STAC9220_A2	HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7880)
+#define HDA_CODEC_STAC9220_A1	HDA_CODEC_CONSTRUCT(SIGMATEL, 0x7882)
 #define HDA_CODEC_STACXXXX	HDA_CODEC_CONSTRUCT(SIGMATEL, 0xffff)
 
+/* IDT */
+#define IDT_VENDORID		0x111d
+#define HDA_CODEC_IDT92HD75BX	HDA_CODEC_CONSTRUCT(IDT, 0x7603)
+#define HDA_CODEC_IDT92HD83C1X	HDA_CODEC_CONSTRUCT(IDT, 0x7604)
+#define HDA_CODEC_IDT92HD81B1X	HDA_CODEC_CONSTRUCT(IDT, 0x7605)
+#define HDA_CODEC_IDT92HD75B3	HDA_CODEC_CONSTRUCT(IDT, 0x7608)
+#define HDA_CODEC_IDT92HD73D1	HDA_CODEC_CONSTRUCT(IDT, 0x7674)
+#define HDA_CODEC_IDT92HD73C1	HDA_CODEC_CONSTRUCT(IDT, 0x7675)
+#define HDA_CODEC_IDT92HD73E1	HDA_CODEC_CONSTRUCT(IDT, 0x7676)
+#define HDA_CODEC_IDT92HD71B8	HDA_CODEC_CONSTRUCT(IDT, 0x76b0)
+#define HDA_CODEC_IDT92HD71B7	HDA_CODEC_CONSTRUCT(IDT, 0x76b2)
+#define HDA_CODEC_IDT92HD71B5	HDA_CODEC_CONSTRUCT(IDT, 0x76b6)
+#define HDA_CODEC_IDT92HD83C1C	HDA_CODEC_CONSTRUCT(IDT, 0x76d4)
+#define HDA_CODEC_IDT92HD81B1C	HDA_CODEC_CONSTRUCT(IDT, 0x76d5)
+#define HDA_CODEC_IDTXXXX	HDA_CODEC_CONSTRUCT(IDT, 0xffff)
+
 /* Silicon Image */
 #define SII_VENDORID	0x1095
 #define HDA_CODEC_SIIXXXX	HDA_CODEC_CONSTRUCT(SII, 0xffff)
@@ -632,6 +672,9 @@ static const struct {
 /* NVIDIA */
 #define HDA_CODEC_NVIDIAXXXX	HDA_CODEC_CONSTRUCT(NVIDIA, 0xffff)
 
+/* INTEL */
+#define HDA_CODEC_INTELXXXX	HDA_CODEC_CONSTRUCT(INTEL, 0xffff)
+
 /* Codecs */
 static const struct {
 	uint32_t id;
@@ -661,21 +704,57 @@ static const struct {
 	{ HDA_CODEC_AD1988,    "Analog Devices AD1988" },
 	{ HDA_CODEC_AD1988B,   "Analog Devices AD1988B" },
 	{ HDA_CODEC_CMI9880,   "CMedia CMI9880" },
+	{ HDA_CODEC_STAC9200D, "Sigmatel STAC9200D" },
+	{ HDA_CODEC_STAC9204X, "Sigmatel STAC9204X" },
+	{ HDA_CODEC_STAC9204D, "Sigmatel STAC9204D" },
+	{ HDA_CODEC_STAC9205X, "Sigmatel STAC9205X" },
+	{ HDA_CODEC_STAC9205D, "Sigmatel STAC9205D" },
+	{ HDA_CODEC_STAC9220,  "Sigmatel STAC9220" },
+	{ HDA_CODEC_STAC9220_A1, "Sigmatel STAC9220_A1" },
+	{ HDA_CODEC_STAC9220_A2, "Sigmatel STAC9220_A2" },
 	{ HDA_CODEC_STAC9221,  "Sigmatel STAC9221" },
+	{ HDA_CODEC_STAC9221_A2, "Sigmatel STAC9221_A2" },
 	{ HDA_CODEC_STAC9221D, "Sigmatel STAC9221D" },
-	{ HDA_CODEC_STAC9220,  "Sigmatel STAC9220" },
 	{ HDA_CODEC_STAC922XD, "Sigmatel STAC9220D/9223D" },
-	{ HDA_CODEC_STAC9230X, "Sigmatel STAC9230X" },
-	{ HDA_CODEC_STAC9230D, "Sigmatel STAC9230D" },
-	{ HDA_CODEC_STAC9229X, "Sigmatel STAC9229X" },
-	{ HDA_CODEC_STAC9229D, "Sigmatel STAC9229D" },
-	{ HDA_CODEC_STAC9228X, "Sigmatel STAC9228X" },
-	{ HDA_CODEC_STAC9228D, "Sigmatel STAC9228D" },
 	{ HDA_CODEC_STAC9227X, "Sigmatel STAC9227X" },
 	{ HDA_CODEC_STAC9227D, "Sigmatel STAC9227D" },
+	{ HDA_CODEC_STAC9228X, "Sigmatel STAC9228X" },
+	{ HDA_CODEC_STAC9228D, "Sigmatel STAC9228D" },
+	{ HDA_CODEC_STAC9229X, "Sigmatel STAC9229X" },
+	{ HDA_CODEC_STAC9229D, "Sigmatel STAC9229D" },
+	{ HDA_CODEC_STAC9230X, "Sigmatel STAC9230X" },
+	{ HDA_CODEC_STAC9230D, "Sigmatel STAC9230D" },
+	{ HDA_CODEC_STAC9250,  "Sigmatel STAC9250" },
+	{ HDA_CODEC_STAC9251,  "Sigmatel STAC9251" },
+	{ HDA_CODEC_STAC9271X, "Sigmatel STAC9271X" },
 	{ HDA_CODEC_STAC9271D, "Sigmatel STAC9271D" },
-	{ HDA_CODEC_STAC9205,  "Sigmatel STAC9205" },
-	{ HDA_CODEC_STAC9872AK,"Sigmatel STAC9872AK" },
+	{ HDA_CODEC_STAC9272X, "Sigmatel STAC9272X" },
+	{ HDA_CODEC_STAC9272D, "Sigmatel STAC9272D" },
+	{ HDA_CODEC_STAC9273X, "Sigmatel STAC9273X" },
+	{ HDA_CODEC_STAC9273D, "Sigmatel STAC9273D" },
+	{ HDA_CODEC_STAC9274,  "Sigmatel STAC9274" },
+	{ HDA_CODEC_STAC9274D, "Sigmatel STAC9274D" },
+	{ HDA_CODEC_STAC9274X5NH, "Sigmatel STAC9274X5NH" },
+	{ HDA_CODEC_STAC9274D5NH, "Sigmatel STAC9274D5NH" },
+	{ HDA_CODEC_STAC9872AK, "Sigmatel STAC9872AK" },
+	{ HDA_CODEC_IDT92HD005, "IDT 92HD005" },
+	{ HDA_CODEC_IDT92HD005D, "IDT 92HD005D" },
+	{ HDA_CODEC_IDT92HD206X, "IDT 92HD206X" },
+	{ HDA_CODEC_IDT92HD206D, "IDT 92HD206D" },
+	{ HDA_CODEC_IDT92HD700X, "IDT 92HD700X" },
+	{ HDA_CODEC_IDT92HD700D, "IDT 92HD700D" },
+	{ HDA_CODEC_IDT92HD71B5, "IDT 92HD71B5" },
+	{ HDA_CODEC_IDT92HD71B7, "IDT 92HD71B7" },
+	{ HDA_CODEC_IDT92HD71B8, "IDT 92HD71B8" },
+	{ HDA_CODEC_IDT92HD73C1, "IDT 92HD73C1" },
+	{ HDA_CODEC_IDT92HD73D1, "IDT 92HD73D1" },
+	{ HDA_CODEC_IDT92HD73E1, "IDT 92HD73E1" },
+	{ HDA_CODEC_IDT92HD75B3, "IDT 92HD75B3" },
+	{ HDA_CODEC_IDT92HD75BX, "IDT 92HD75BX" },
+	{ HDA_CODEC_IDT92HD81B1C, "IDT 92HD81B1C" },
+	{ HDA_CODEC_IDT92HD81B1X, "IDT 92HD81B1X" },
+	{ HDA_CODEC_IDT92HD83C1C, "IDT 92HD83C1C" },
+	{ HDA_CODEC_IDT92HD83C1X, "IDT 92HD83C1X" },
 	{ HDA_CODEC_CXVENICE,  "Conexant Venice" },
 	{ HDA_CODEC_CXWAIKIKI, "Conexant Waikiki" },
 	{ HDA_CODEC_VT1708_8,  "VIA VT1708_8" },
@@ -701,6 +780,8 @@ static const struct {
 	{ HDA_CODEC_VTXXXX,    "VIA (Unknown)" },
 	{ HDA_CODEC_ATIXXXX,   "ATI (Unknown)" },
 	{ HDA_CODEC_NVIDIAXXXX,"NVidia (Unknown)" },
+	{ HDA_CODEC_INTELXXXX, "Intel (Unknown)" },
+	{ HDA_CODEC_IDTXXXX,   "IDT (Unknown)" },
 };
 #define HDAC_CODECS_LEN	(sizeof(hdac_codecs) / sizeof(hdac_codecs[0]))
 
@@ -4340,9 +4421,9 @@ static const struct {
 	    HDA_QUIRK_GPIO0 | HDA_QUIRK_OVREF50, 0},
 	{ APPLE_INTEL_MAC, HDA_CODEC_STAC9221,
 	    HDA_QUIRK_GPIO0 | HDA_QUIRK_GPIO1, 0 },
-	{ DELL_D630_SUBVENDOR, HDA_CODEC_STAC9205,
+	{ DELL_D630_SUBVENDOR, HDA_CODEC_STAC9205X,
 	    HDA_QUIRK_GPIO0, 0 },
-	{ DELL_V1500_SUBVENDOR, HDA_CODEC_STAC9205,
+	{ DELL_V1500_SUBVENDOR, HDA_CODEC_STAC9205X,
 	    HDA_QUIRK_GPIO0, 0 },
 	{ HDA_MATCH_ALL, HDA_CODEC_AD1988,
 	    HDA_QUIRK_IVREF80, HDA_QUIRK_IVREF50 | HDA_QUIRK_IVREF100 },

From owner-svn-src-head@FreeBSD.ORG  Tue Oct 14 20:18:57 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C7298106569B;
	Tue, 14 Oct 2008 20:18:57 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B61668FC2F;
	Tue, 14 Oct 2008 20:18:57 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9EKIv61015294;
	Tue, 14 Oct 2008 20:18:57 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9EKIvZw015293;
	Tue, 14 Oct 2008 20:18:57 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <200810142018.m9EKIvZw015293@svn.freebsd.org>
From: Marius Strobl 
Date: Tue, 14 Oct 2008 20:18:57 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183895 - head/sys/dev/sym
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 14 Oct 2008 20:18:57 -0000

Author: marius
Date: Tue Oct 14 20:18:57 2008
New Revision: 183895
URL: http://svn.freebsd.org/changeset/base/183895

Log:
  Use xpt_register_async() in order to remove code duplication.
  
  MFC after:	1 month

Modified:
  head/sys/dev/sym/sym_hipd.c

Modified: head/sys/dev/sym/sym_hipd.c
==============================================================================
--- head/sys/dev/sym/sym_hipd.c	Tue Oct 14 19:58:26 2008	(r183894)
+++ head/sys/dev/sym/sym_hipd.c	Tue Oct 14 20:18:57 2008	(r183895)
@@ -8974,7 +8974,6 @@ static int sym_cam_attach(hcb_p np)
 	struct cam_devq *devq = NULL;
 	struct cam_sim *sim = NULL;
 	struct cam_path *path = NULL;
-	struct ccb_setasync csa;
 	int err;
 
 	/*
@@ -9021,12 +9020,9 @@ static int sym_cam_attach(hcb_p np)
 	/*
 	 *  Establish our async notification handler.
 	 */
-	xpt_setup_ccb(&csa.ccb_h, np->path, 5);
-	csa.ccb_h.func_code = XPT_SASYNC_CB;
-	csa.event_enable    = AC_LOST_DEVICE;
-	csa.callback	    = sym_async;
-	csa.callback_arg    = np->sim;
-	xpt_action((union ccb *)&csa);
+	if (xpt_register_async(AC_LOST_DEVICE, sym_async, sim, path) !=
+	    CAM_REQ_CMP)
+		goto fail;
 
 	/*
 	 *  Start the chip now, without resetting the BUS, since

From owner-svn-src-head@FreeBSD.ORG  Tue Oct 14 20:28:43 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5798010656AA;
	Tue, 14 Oct 2008 20:28:43 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2D2608FC08;
	Tue, 14 Oct 2008 20:28:43 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9EKShEu015516;
	Tue, 14 Oct 2008 20:28:43 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9EKShoL015514;
	Tue, 14 Oct 2008 20:28:43 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <200810142028.m9EKShoL015514@svn.freebsd.org>
From: Marius Strobl 
Date: Tue, 14 Oct 2008 20:28:43 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183896 - head/sys/dev/bge
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 14 Oct 2008 20:28:43 -0000

Author: marius
Date: Tue Oct 14 20:28:42 2008
New Revision: 183896
URL: http://svn.freebsd.org/changeset/base/183896

Log:
  Use bus_{read,write}_4(9) instead of bus_space_{read,write}_4(9)
  in order to get rid of the bus space handle and tag in the softc.
  
  MFC after:	1 month

Modified:
  head/sys/dev/bge/if_bge.c
  head/sys/dev/bge/if_bgereg.h

Modified: head/sys/dev/bge/if_bge.c
==============================================================================
--- head/sys/dev/bge/if_bge.c	Tue Oct 14 20:18:57 2008	(r183895)
+++ head/sys/dev/bge/if_bge.c	Tue Oct 14 20:28:42 2008	(r183896)
@@ -2377,11 +2377,7 @@ bge_attach(device_t dev)
 		goto fail;
 	}
 
-	sc->bge_btag = rman_get_bustag(sc->bge_res);
-	sc->bge_bhandle = rman_get_bushandle(sc->bge_res);
-
 	/* Save ASIC rev. */
-
 	sc->bge_chipid =
 	    pci_read_config(dev, BGE_PCI_MISC_CTL, 4) &
 	    BGE_PCIMISCCTL_ASICREV;

Modified: head/sys/dev/bge/if_bgereg.h
==============================================================================
--- head/sys/dev/bge/if_bgereg.h	Tue Oct 14 20:18:57 2008	(r183895)
+++ head/sys/dev/bge/if_bgereg.h	Tue Oct 14 20:28:42 2008	(r183896)
@@ -1896,8 +1896,7 @@ struct bge_rcb {
 };
 
 #define	RCB_WRITE_4(sc, rcb, offset, val) \
-	bus_space_write_4(sc->bge_btag, sc->bge_bhandle, \
-			  rcb + offsetof(struct bge_rcb, offset), val)
+	bus_write_4(sc->bge_res, rcb + offsetof(struct bge_rcb, offset), val)
 #define	BGE_RCB_MAXLEN_FLAGS(maxlen, flags)	((maxlen) << 16 | (flags))
 
 #define	BGE_RCB_FLAG_USE_EXT_RX_BD	0x0001
@@ -2394,10 +2393,10 @@ struct bge_gib {
  */
 
 #define	CSR_WRITE_4(sc, reg, val)	\
-	bus_space_write_4(sc->bge_btag, sc->bge_bhandle, reg, val)
+	bus_write_4(sc->bge_res, reg, val)
 
 #define	CSR_READ_4(sc, reg)		\
-	bus_space_read_4(sc->bge_btag, sc->bge_bhandle, reg)
+	bus_read_4(sc->bge_res, reg)
 
 #define	BGE_SETBIT(sc, reg, x)	\
 	CSR_WRITE_4(sc, reg, (CSR_READ_4(sc, reg) | (x)))
@@ -2522,8 +2521,6 @@ struct bge_softc {
 	device_t		bge_dev;
 	struct mtx		bge_mtx;
 	device_t		bge_miibus;
-	bus_space_handle_t	bge_bhandle;
-	bus_space_tag_t		bge_btag;
 	void			*bge_intrhand;
 	struct resource		*bge_irq;
 	struct resource		*bge_res;

From owner-svn-src-head@FreeBSD.ORG  Tue Oct 14 20:45:13 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0170A1065687
	for ; Tue, 14 Oct 2008 20:45:13 +0000 (UTC)
	(envelope-from asmrookie@gmail.com)
Received: from yw-out-2324.google.com (yw-out-2324.google.com [74.125.46.31])
	by mx1.freebsd.org (Postfix) with ESMTP id AC1E78FC24
	for ; Tue, 14 Oct 2008 20:45:12 +0000 (UTC)
	(envelope-from asmrookie@gmail.com)
Received: by yw-out-2324.google.com with SMTP id 9so576236ywe.13
	for ; Tue, 14 Oct 2008 13:45:11 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:received:received:message-id:date:from:sender
	:to:subject:cc:in-reply-to:mime-version:content-type
	:content-transfer-encoding:content-disposition:references
	:x-google-sender-auth;
	bh=pIbr0BBYSqOkENYsQ6X/OV7oFZjVvrMzx+0rZFSQiVg=;
	b=OkzhTuAvr7nSAyezPEb++RALlUuSnsIrOGZsvg2nc9FJFwINLg5IEp+IsMkm25Jisf
	SNKeIbNYsNNKYcGT86xP7FeINDCLjCwdRCJS9MRG9H6xX9+TdphfXEBxk6bQ4hr3YF6H
	ftOZL8SteKYaMKtCkIsjs2QZwJpjTwQnweQ/0=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version
	:content-type:content-transfer-encoding:content-disposition
	:references:x-google-sender-auth;
	b=hdyNwnE+m5OfcXNKLygWrufWfQ9L1sWAO+AqUVYQC0lAsSIE0YhSMn0rwoZgzcHBNr
	cvLZ4fyG2LnFjfiNfss5rjCeaM8Y8suj7lNUm55FxHc4W4IC9Zm20KMcjnYCsNTd+dDr
	Qhf0ai0eoH8P6OeK0Hw5GGwkAnXbfl9jPGFsU=
Received: by 10.103.170.13 with SMTP id x13mr2003muo.27.1224015761414;
	Tue, 14 Oct 2008 13:22:41 -0700 (PDT)
Received: by 10.103.239.14 with HTTP; Tue, 14 Oct 2008 13:22:41 -0700 (PDT)
Message-ID: <3bbf2fe10810141322o5ee27a2eka8a3a902ced6fc97@mail.gmail.com>
Date: Tue, 14 Oct 2008 22:22:41 +0200
From: "Attilio Rao" 
Sender: asmrookie@gmail.com
To: "Rafal Jaworowski" 
In-Reply-To: <200810140705.m9E75K3x098307@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
References: <200810140705.m9E75K3x098307@svn.freebsd.org>
X-Google-Sender-Auth: 702ec6ba63711b08
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r183866 - head/sys/dev/usb
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 14 Oct 2008 20:45:13 -0000

2008/10/14, Rafal Jaworowski :
> Author: raj
>  Date: Tue Oct 14 07:05:20 2008
>  New Revision: 183866
>  URL: http://svn.freebsd.org/changeset/base/183866
>
>  Log:
>   Mbus attachment for USB EHCI integrated controller on Marvell chips.
>
>   This includes workarounds required for the ehci(4) to handle some non-standard
>   behaviour of these devices.
>
>   Obtained from:        Marvell, Semihalf
>
>  Added:
>   head/sys/dev/usb/ehci_mbus.c   (contents, props changed)
>  Modified:
>   head/sys/dev/usb/ehci.c
>   head/sys/dev/usb/ehcivar.h
>
>  Modified: head/sys/dev/usb/ehci.c
>  ==============================================================================
>  --- head/sys/dev/usb/ehci.c     Tue Oct 14 04:09:33 2008        (r183865)
>  +++ head/sys/dev/usb/ehci.c     Tue Oct 14 07:05:20 2008        (r183866)
>  @@ -351,8 +351,12 @@ ehci_hcreset(ehci_softc_t *sc)
>         for (i = 0; i < 100; i++) {
>                 usb_delay_ms(&sc->sc_bus, 1);
>                 hcr = EOREAD4(sc, EHCI_USBCMD) & EHCI_CMD_HCRESET;
>  -               if (!hcr)
>  +               if (!hcr) {
>  +                       if (sc->sc_flags & EHCI_SCFLG_SETMODE)
>  +                               EOWRITE4(sc,  0x68, 0x3);
>  +
>                         return (USBD_NORMAL_COMPLETION);
>  +               }
>         }
>         printf("%s: reset timeout\n", device_get_nameunit(sc->sc_bus.bdev));
>         return (USBD_IOERROR);
>  @@ -2194,7 +2198,18 @@ ehci_root_ctrl_start(usbd_xfer_handle xf
>                 v = EOREAD4(sc, EHCI_PORTSC(index));
>                 DPRINTFN(8,("ehci_root_ctrl_start: port status=0x%04x\n",
>                             v));
>  +
>                 i = UPS_HIGH_SPEED;
>  +
>  +               if (sc->sc_flags & EHCI_SCFLG_FORCESPEED) {
>  +                       if ((v & 0xc000000) == 0x8000000)
>  +                               i = UPS_HIGH_SPEED;
>  +                       else if ((v & 0xc000000) == 0x4000000)
>  +                               i = UPS_LOW_SPEED;
>  +                       else
>  +                               i = 0;
>  +               }
>  +
>                 if (v & EHCI_PS_CS)     i |= UPS_CURRENT_CONNECT_STATUS;
>                 if (v & EHCI_PS_PE)     i |= UPS_PORT_ENABLED;
>                 if (v & EHCI_PS_SUSP)   i |= UPS_SUSPEND;
>  @@ -2249,7 +2264,11 @@ ehci_root_ctrl_start(usbd_xfer_handle xf
>                                 goto ret;
>                         }
>                         /* Terminate reset sequence. */
>  -                       EOWRITE4(sc, port, v);
>  +                       if (sc->sc_flags & EHCI_SCFLG_NORESTERM)
>  +                               ;
>  +                       else
>  +                               EOWRITE4(sc, port, v);
>  +
>                         /* Wait for HC to complete reset. */
>                         usb_delay_ms(&sc->sc_bus, EHCI_PORT_RESET_COMPLETE);
>                         if (sc->sc_dying) {
>
>  Added: head/sys/dev/usb/ehci_mbus.c
>  ==============================================================================
>  --- /dev/null   00:00:00 1970   (empty, because file is newly added)
>  +++ head/sys/dev/usb/ehci_mbus.c        Tue Oct 14 07:05:20 2008        (r183866)
>  @@ -0,0 +1,318 @@
>  +/*-
>  + * Copyright (C) 2008 MARVELL INTERNATIONAL LTD.
>  + * All rights reserved.
>  + *
>  + * Developed by Semihalf.
>  + *
>  + * 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.
>  + * 3. Neither the name of MARVELL nor the names of contributors
>  + *    may be used to endorse or promote products derived from this software
>  + *    without specific prior written permission.
>  + *
>  + * THIS SOFTWARE IS PROVIDED BY 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 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.
>  + */
>  +
>  +/*
>  + * MBus attachment driver for the USB Enhanced Host Controller.
>  + */
>  +
>  +#include 
>  +__FBSDID("$FreeBSD$");
>  +
>  +#include "opt_bus.h"
>  +
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 
>  +#include 

Why this includes lockmgr?
I don't think it needs.

Thanks,
Attilio


-- 
Peace can only be achieved by understanding - A. Einstein

From owner-svn-src-head@FreeBSD.ORG  Tue Oct 14 21:20:52 2008
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4E7F9106569B;
	Tue, 14 Oct 2008 21:20:52 +0000 (UTC)
	(envelope-from scottl@samsco.org)
Received: from pooker.samsco.org (pooker.samsco.org [168.103.85.57])
	by mx1.freebsd.org (Postfix) with ESMTP id 00DF68FC17;
	Tue, 14 Oct 2008 21:20:51 +0000 (UTC)
	(envelope-from scottl@samsco.org)
Received: from phobos.local ([192.168.254.200]) (authenticated bits=0)
	by pooker.samsco.org (8.14.2/8.14.2) with ESMTP id m9EKkriM035017;
	Tue, 14 Oct 2008 14:47:09 -0600 (MDT)
	(envelope-from scottl@samsco.org)
Message-ID: <48F5053D.7070705@samsco.org>
Date: Tue, 14 Oct 2008 14:46:53 -0600
From: Scott Long 
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US;
	rv:1.8.1.13) Gecko/20080313 SeaMonkey/1.1.9
MIME-Version: 1.0
To: Marius Strobl 
References: <200810142028.m9EKShoL015514@svn.freebsd.org>
In-Reply-To: <200810142028.m9EKShoL015514@svn.freebsd.org>
X-Enigmail-Version: 0.95.6
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Status: No, score=-4.4 required=3.8 tests=ALL_TRUSTED,BAYES_00
	autolearn=ham version=3.1.8
X-Spam-Checker-Version: SpamAssassin 3.1.8 (2007-02-13) on pooker.samsco.org
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r183896 - head/sys/dev/bge
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 14 Oct 2008 21:20:52 -0000

Marius Strobl wrote:
> Author: marius
> Date: Tue Oct 14 20:28:42 2008
> New Revision: 183896
> URL: http://svn.freebsd.org/changeset/base/183896
> 
> Log:
>   Use bus_{read,write}_4(9) instead of bus_space_{read,write}_4(9)
>   in order to get rid of the bus space handle and tag in the softc.
>   

Has anyone looked at the generated code from this interface switch and
compared it what was getting generated previously?  Way back when,
including  made bus_space_read|write_4() compile
into a direct memory access on machines that supported it.  The dubious
removal of bus_memio.h and bus_pio.h took away that benefit, and I'm
afraid that it's only getting worse now.  Bus writes to card memory are
still very important to high-performance devices and shouldn't be
pessimized in the name of simpler-looking C code.

Scott

From owner-svn-src-head@FreeBSD.ORG  Tue Oct 14 21:22:29 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D93DF10656A3;
	Tue, 14 Oct 2008 21:22:29 +0000 (UTC)
	(envelope-from bzeeb-lists@lists.zabbadoz.net)
Received: from mail.cksoft.de (mail.cksoft.de [62.111.66.27])
	by mx1.freebsd.org (Postfix) with ESMTP id 867D88FC2C;
	Tue, 14 Oct 2008 21:22:29 +0000 (UTC)
	(envelope-from bzeeb-lists@lists.zabbadoz.net)
Received: from localhost (amavis.str.cksoft.de [192.168.74.71])
	by mail.cksoft.de (Postfix) with ESMTP id A1D4141C667;
	Tue, 14 Oct 2008 23:05:05 +0200 (CEST)
X-Virus-Scanned: amavisd-new at cksoft.de
Received: from mail.cksoft.de ([62.111.66.27])
	by localhost (amavis.str.cksoft.de [192.168.74.71]) (amavisd-new,
	port 10024)
	with ESMTP id KGVPgZZgPngS; Tue, 14 Oct 2008 23:05:05 +0200 (CEST)
Received: by mail.cksoft.de (Postfix, from userid 66)
	id 2F4AB41C64C; Tue, 14 Oct 2008 23:05:05 +0200 (CEST)
Received: from maildrop.int.zabbadoz.net (maildrop.int.zabbadoz.net
	[10.111.66.10])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mail.int.zabbadoz.net (Postfix) with ESMTP id 2974A44487F;
	Tue, 14 Oct 2008 21:04:12 +0000 (UTC)
Date: Tue, 14 Oct 2008 21:04:12 +0000 (UTC)
From: "Bjoern A. Zeeb" 
X-X-Sender: bz@maildrop.int.zabbadoz.net
To: VANHULLEBUS Yvan , 
	"George V. Neville-Neil" 
In-Reply-To: <200808301027.m7UARLZr010667@repoman.freebsd.org>
Message-ID: <20081014205902.U2978@maildrop.int.zabbadoz.net>
References: <200808301027.m7UARLZr010667@repoman.freebsd.org>
X-OpenPGP-Key: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@FreeBSD.org
Subject: Re: cvs commit: src/sys/net if_enc.c if_enc.h src/sys/netipsec 
 ipsec_input.c ipsec_output.c
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Tue, 14 Oct 2008 21:22:33 -0000

On Sat, 30 Aug 2008, VANHULLEBUS Yvan wrote:

> vanhu       2008-08-30 10:25:57 UTC
>
>  FreeBSD src repository
>
>  Modified files:        (Branch: RELENG_7)
>    sys/net              if_enc.c
>    sys/netipsec         ipsec_input.c ipsec_output.c
>  Added files:           (Branch: RELENG_7)
>    sys/net              if_enc.h
>  Log:
>  SVN rev 182472 on 2008-08-30 10:25:57Z by vanhu
>
>  MFC: Increase statistic counters for enc0 interface when enabled
>  and processing IPSec traffic.
>
>  Approved by:    gnn (mentor)
>
>  Revision  Changes    Path
>  1.6.2.2   +1 -1      src/sys/net/if_enc.c
>  1.1.2.1   +35 -0     src/sys/net/if_enc.h (new)
>  1.19.2.1  +8 -0      src/sys/netipsec/ipsec_input.c
>  1.16.2.2  +8 -0      src/sys/netipsec/ipsec_output.c


It seems this MFC was incomplete?

I miss the counters is:
 	ipsec6_output_tunnel():
 	- http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/netipsec/ipsec_output.c.diff?r1=1.19;r2=1.20
 	- http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/netipsec/ipsec_output.c.diff?r1=1.16.2.1;r2=1.16.2.2

 	ipsec6_common_input_cb():
 	- http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/netipsec/ipsec_input.c.diff?r1=1.21;r2=1.22
 	- http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/netipsec/ipsec_input.c.diff?r1=1.19;r2=1.19.2.1

Was that on purpose?

/bz

-- 
Bjoern A. Zeeb              Stop bit received. Insert coin for new game.

From owner-svn-src-head@FreeBSD.ORG  Wed Oct 15 03:38:03 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A9ABF1065686;
	Wed, 15 Oct 2008 03:38:03 +0000 (UTC)
	(envelope-from nwhitehorn@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 986558FC21;
	Wed, 15 Oct 2008 03:38:03 +0000 (UTC)
	(envelope-from nwhitehorn@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9F3c3F2023145;
	Wed, 15 Oct 2008 03:38:03 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Received: (from nwhitehorn@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9F3c3qr023144;
	Wed, 15 Oct 2008 03:38:03 GMT
	(envelope-from nwhitehorn@svn.freebsd.org)
Message-Id: <200810150338.m9F3c3qr023144@svn.freebsd.org>
From: Nathan Whitehorn 
Date: Wed, 15 Oct 2008 03:38:03 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183901 - head/sys/powerpc/ofw
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 15 Oct 2008 03:38:03 -0000

Author: nwhitehorn
Date: Wed Oct 15 03:38:03 2008
New Revision: 183901
URL: http://svn.freebsd.org/changeset/base/183901

Log:
  Prevent the OF syscons module from trying to attach to real devices on the
  nexus by only attaching to a device with no OF node.

Modified:
  head/sys/powerpc/ofw/ofw_syscons.c

Modified: head/sys/powerpc/ofw/ofw_syscons.c
==============================================================================
--- head/sys/powerpc/ofw/ofw_syscons.c	Wed Oct 15 00:54:57 2008	(r183900)
+++ head/sys/powerpc/ofw/ofw_syscons.c	Wed Oct 15 03:38:03 2008	(r183901)
@@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
 #include 
 #include 
 
@@ -845,6 +846,10 @@ ofwfb_scidentify(driver_t *driver, devic
 static int
 ofwfb_scprobe(device_t dev)
 {
+	/* This is a fake device, so make sure there is no OF node for it */
+	if (ofw_bus_get_node(dev) != -1)
+		return ENXIO;
+	
 	device_set_desc(dev, "System console");
 	return (sc_probe_unit(device_get_unit(dev), 
 	    device_get_flags(dev) | SC_AUTODETECT_KBD));

From owner-svn-src-head@FreeBSD.ORG  Wed Oct 15 06:31:37 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 989321065688;
	Wed, 15 Oct 2008 06:31:37 +0000 (UTC)
	(envelope-from davidxu@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8774A8FC13;
	Wed, 15 Oct 2008 06:31:37 +0000 (UTC)
	(envelope-from davidxu@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9F6VbxF026579;
	Wed, 15 Oct 2008 06:31:37 GMT (envelope-from davidxu@svn.freebsd.org)
Received: (from davidxu@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9F6VbTG026574;
	Wed, 15 Oct 2008 06:31:37 GMT (envelope-from davidxu@svn.freebsd.org)
Message-Id: <200810150631.m9F6VbTG026574@svn.freebsd.org>
From: David Xu 
Date: Wed, 15 Oct 2008 06:31:37 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183911 - in head/sys: kern sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 15 Oct 2008 06:31:37 -0000

Author: davidxu
Date: Wed Oct 15 06:31:37 2008
New Revision: 183911
URL: http://svn.freebsd.org/changeset/base/183911

Log:
  Move per-thread userland debugging flags into seperated field,
  this eliminates some problems of locking, e.g, a thread lock is needed
  but can not be used at that time. Only the process lock is needed now
  for new field.

Modified:
  head/sys/kern/kern_exit.c
  head/sys/kern/kern_sig.c
  head/sys/kern/kern_thread.c
  head/sys/kern/sys_process.c
  head/sys/sys/proc.h

Modified: head/sys/kern/kern_exit.c
==============================================================================
--- head/sys/kern/kern_exit.c	Wed Oct 15 06:21:54 2008	(r183910)
+++ head/sys/kern/kern_exit.c	Wed Oct 15 06:31:37 2008	(r183911)
@@ -438,7 +438,11 @@ exit1(struct thread *td, int rv)
 		 * since their existence means someone is screwing up.
 		 */
 		if (q->p_flag & P_TRACED) {
+			struct thread *temp;
+
 			q->p_flag &= ~(P_TRACED | P_STOPPED_TRACE);
+			FOREACH_THREAD_IN_PROC(q, temp)
+				temp->td_dbgflags &= ~TDB_SUSPEND;
 			psignal(q, SIGKILL);
 		}
 		PROC_UNLOCK(q);

Modified: head/sys/kern/kern_sig.c
==============================================================================
--- head/sys/kern/kern_sig.c	Wed Oct 15 06:21:54 2008	(r183910)
+++ head/sys/kern/kern_sig.c	Wed Oct 15 06:31:37 2008	(r183911)
@@ -2342,16 +2342,12 @@ ptracestop(struct thread *td, int sig)
 	WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK,
 	    &p->p_mtx.lock_object, "Stopping for traced signal");
 
-	thread_lock(td);
-	td->td_flags |= TDF_XSIG;
-	thread_unlock(td);
+	td->td_dbgflags |= TDB_XSIG;
 	td->td_xsig = sig;
 	PROC_SLOCK(p);
-	while ((p->p_flag & P_TRACED) && (td->td_flags & TDF_XSIG)) {
+	while ((p->p_flag & P_TRACED) && (td->td_dbgflags & TDB_XSIG)) {
 		if (p->p_flag & P_SINGLE_EXIT) {
-			thread_lock(td);
-			td->td_flags &= ~TDF_XSIG;
-			thread_unlock(td);
+			td->td_dbgflags &= ~TDB_XSIG;
 			PROC_SUNLOCK(p);
 			return (sig);
 		}
@@ -2368,7 +2364,7 @@ stopme:
 		if (!(p->p_flag & P_TRACED)) {
 			break;
 		}
-		if (td->td_flags & TDF_DBSUSPEND) {
+		if (td->td_dbgflags & TDB_SUSPEND) {
 			if (p->p_flag & P_SINGLE_EXIT)
 				break;
 			goto stopme;

Modified: head/sys/kern/kern_thread.c
==============================================================================
--- head/sys/kern/kern_thread.c	Wed Oct 15 06:21:54 2008	(r183910)
+++ head/sys/kern/kern_thread.c	Wed Oct 15 06:31:37 2008	(r183911)
@@ -563,8 +563,6 @@ thread_single(int mode)
 			if (TD_IS_INHIBITED(td2)) {
 				switch (mode) {
 				case SINGLE_EXIT:
-					if (td->td_flags & TDF_DBSUSPEND)
-						td->td_flags &= ~TDF_DBSUSPEND;
 					if (TD_IS_SUSPENDED(td2))
 						wakeup_swapper |=
 						    thread_unsuspend_one(td2);
@@ -685,7 +683,7 @@ thread_suspend_check(int return_instead)
 	mtx_assert(&Giant, MA_NOTOWNED);
 	PROC_LOCK_ASSERT(p, MA_OWNED);
 	while (P_SHOULDSTOP(p) ||
-	      ((p->p_flag & P_TRACED) && (td->td_flags & TDF_DBSUSPEND))) {
+	      ((p->p_flag & P_TRACED) && (td->td_dbgflags & TDB_SUSPEND))) {
 		if (P_SHOULDSTOP(p) == P_STOPPED_SINGLE) {
 			KASSERT(p->p_singlethread != NULL,
 			    ("singlethread not set"));

Modified: head/sys/kern/sys_process.c
==============================================================================
--- head/sys/kern/sys_process.c	Wed Oct 15 06:21:54 2008	(r183910)
+++ head/sys/kern/sys_process.c	Wed Oct 15 06:31:37 2008	(r183911)
@@ -700,15 +700,14 @@ kern_ptrace(struct thread *td, int req, 
 		break;
 
 	case PT_SUSPEND:
+		td2->td_dbgflags |= TDB_SUSPEND;
 		thread_lock(td2);
-		td2->td_flags |= TDF_DBSUSPEND;
+		td2->td_flags |= TDF_NEEDSUSPCHK;
 		thread_unlock(td2);
 		break;
 
 	case PT_RESUME:
-		thread_lock(td2);
-		td2->td_flags &= ~TDF_DBSUSPEND;
-		thread_unlock(td2);
+		td2->td_dbgflags &= ~TDB_SUSPEND;
 		break;
 
 	case PT_STEP:
@@ -782,17 +781,13 @@ kern_ptrace(struct thread *td, int req, 
 		p->p_xthread = NULL;
 		if ((p->p_flag & (P_STOPPED_SIG | P_STOPPED_TRACE)) != 0) {
 			/* deliver or queue signal */
-			thread_lock(td2);
-			td2->td_flags &= ~TDF_XSIG;
-			thread_unlock(td2);
+			td2->td_dbgflags &= ~TDB_XSIG;
 			td2->td_xsig = data;
 
 			if (req == PT_DETACH) {
 				struct thread *td3;
 				FOREACH_THREAD_IN_PROC(p, td3) {
-					thread_lock(td3);
-					td3->td_flags &= ~TDF_DBSUSPEND; 
-					thread_unlock(td3);
+					td3->td_dbgflags &= ~TDB_SUSPEND; 
 				}
 			}
 			/*
@@ -932,7 +927,7 @@ kern_ptrace(struct thread *td, int req, 
 		}
 		pl = addr;
 		pl->pl_lwpid = td2->td_tid;
-		if (td2->td_flags & TDF_XSIG)
+		if (td2->td_dbgflags & TDB_XSIG)
 			pl->pl_event = PL_EVENT_SIGNAL;
 		else
 			pl->pl_event = 0;

Modified: head/sys/sys/proc.h
==============================================================================
--- head/sys/sys/proc.h	Wed Oct 15 06:21:54 2008	(r183910)
+++ head/sys/sys/proc.h	Wed Oct 15 06:31:37 2008	(r183911)
@@ -232,6 +232,7 @@ struct thread {
 	u_int		td_profil_ticks; /* (k) Temporary ticks until AST. */
 	char		td_name[MAXCOMLEN + 1];	/* (*) Thread name. */
 	struct file	*td_fpop;	/* (k) file referencing cdev under op */
+	int		td_dbgflags;	/* (c) Userland debugger flags */
 #define	td_endzero td_base_pri
 
 /* Copied during fork1() or thread_sched_upcall(). */
@@ -318,10 +319,10 @@ do {									\
 #define	TDF_NEEDSUSPCHK	0x00008000 /* Thread may need to suspend. */
 #define	TDF_NEEDRESCHED	0x00010000 /* Thread needs to yield. */
 #define	TDF_NEEDSIGCHK	0x00020000 /* Thread may need signal delivery. */
-#define	TDF_XSIG	0x00040000 /* Thread is exchanging signal under trace */
+#define	TDF_UNUSED18	0x00040000 /* --available-- */
 #define	TDF_UNUSED19	0x00080000 /* Thread is sleeping on a umtx. */
 #define	TDF_THRWAKEUP	0x00100000 /* Libthr thread must not suspend itself. */
-#define	TDF_DBSUSPEND	0x00200000 /* Thread is suspended by debugger */
+#define	TDF_UNUSED21	0x00200000 /* --available-- */
 #define	TDF_SWAPINREQ	0x00400000 /* Swapin request due to wakeup. */
 #define	TDF_UNUSED23	0x00800000 /* --available-- */
 #define	TDF_SCHED0	0x01000000 /* Reserved for scheduler private use */
@@ -332,6 +333,10 @@ do {									\
 #define	TDF_PROFPEND	0x20000000 /* Pending SIGPROF needs to be posted. */
 #define	TDF_MACPEND	0x40000000 /* AST-based MAC event pending. */
 
+/* Userland debug flags */
+#define	TDB_SUSPEND	0x00000001 /* Thread is suspended by debugger */
+#define	TDB_XSIG	0x00000002 /* Thread is exchanging signal under trace */
+
 /*
  * "Private" flags kept in td_pflags:
  * These are only written by curthread and thus need no locking.

From owner-svn-src-head@FreeBSD.ORG  Wed Oct 15 10:08:29 2008
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BC56D1065687;
	Wed, 15 Oct 2008 10:08:29 +0000 (UTC)
	(envelope-from scottl@samsco.org)
Received: from pooker.samsco.org (pooker.samsco.org [168.103.85.57])
	by mx1.freebsd.org (Postfix) with ESMTP id 5FD838FC15;
	Wed, 15 Oct 2008 10:08:29 +0000 (UTC)
	(envelope-from scottl@samsco.org)
Received: from phobos.local ([192.168.254.200]) (authenticated bits=0)
	by pooker.samsco.org (8.14.2/8.14.2) with ESMTP id m9FA8O2b039982;
	Wed, 15 Oct 2008 04:08:24 -0600 (MDT)
	(envelope-from scottl@samsco.org)
Message-ID: <48F5C118.3040209@samsco.org>
Date: Wed, 15 Oct 2008 04:08:24 -0600
From: Scott Long 
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US;
	rv:1.8.1.13) Gecko/20080313 SeaMonkey/1.1.9
MIME-Version: 1.0
To: Bruce Evans 
References: <200810142028.m9EKShoL015514@svn.freebsd.org>
	<48F5053D.7070705@samsco.org>
	<20081015184833.N43215@delplex.bde.org>
In-Reply-To: <20081015184833.N43215@delplex.bde.org>
X-Enigmail-Version: 0.95.6
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Status: No, score=-4.4 required=3.8 tests=ALL_TRUSTED,BAYES_00
	autolearn=ham version=3.1.8
X-Spam-Checker-Version: SpamAssassin 3.1.8 (2007-02-13) on pooker.samsco.org
Cc: svn-src-head@FreeBSD.org, Marius Strobl ,
	src-committers@FreeBSD.org, svn-src-all@FreeBSD.org
Subject: Re: svn commit: r183896 - head/sys/dev/bge
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 15 Oct 2008 10:08:29 -0000

Bruce Evans wrote:
> On Tue, 14 Oct 2008, Scott Long wrote:
> 
>> Marius Strobl wrote:
>>> Author: marius
>>> Date: Tue Oct 14 20:28:42 2008
>>> New Revision: 183896
>>> URL: http://svn.freebsd.org/changeset/base/183896
>>>
>>> Log:
>>>   Use bus_{read,write}_4(9) instead of bus_space_{read,write}_4(9)
>>>   in order to get rid of the bus space handle and tag in the softc.
>>
>> Has anyone looked at the generated code from this interface switch and
>> compared it what was getting generated previously?  Way back when,
> 
> I just looked at the source code.  This seems to be only a small
> pessimization since it involves just one extra indirection and
> related loss of optimization possibilities: (sc->sc_bt, sc->sc_bh)
> becomes r = sc->sc_br; (r->r_bustag, r->r_bushandle).  In theory,
> the compiler could optimize by caching the tag and handle in registers
> in either case so that only 1 extra indirection is needed per function,
> but I've never seen that being done enough to make much difference.
> 
> However, some drivers (e.g., ata) were too stupid to cache sc_bt and
> sc_bh, and converting these to use bus_nonspace*() was a relatively large
> optimization: r = sc->sc_br; (rman_get_bustag(r), rman_get_bushandle(r))
> became r = sc->sc_br; (r->r_bustag, r->r_bushandle).  Since 
> rman_get_bustag()
> and rman_get_bushandle() have never been inline, calling both of them
> on every bus space access gave enormous code space and instruction
> count bloat and corresponding (relatively tiny) runtime bloat.  The
> instructions normally run so much faster than the i/o that you can do
> hundreds or thousands of them per i/o before noticing the runtime
> bloat, and the instruction count bloat here is only about a factor of 20.

It'll be a long time before disk i/o is fast enough to saturate the CPU
to the point of this issue being important.  Even the fastest SAS
hardware that I've written a driver for struggles to get over 100,000
transactions/sec before saturating the attached disks, leaving plenty
of CPU remaining.

> 
>> including  made bus_space_read|write_4() compile
>> into a direct memory access on machines that supported it.  The dubious
>> removal of bus_memio.h and bus_pio.h took away that benefit, and I'm
>> afraid that it's only getting worse now.  Bus writes to card memory are
>> still very important to high-performance devices and shouldn't be
>> pessimized in the name of simpler-looking C code.
> 
> I hate the bloat too, but it rarely matters (see above).  I mainly noticed
> it using ddb.  Where nice drivers are optimized to use a single instruction
> per i/o (or perhaps 2 with minimal bus space bloat), the ones that use
> rman_get*() on every i/o take 20+, and with a primitive debugger like ddb
> it is painful to even skip over all the function calls.

It's really the opportunity for gratuitous D-cache line misses that
worries me, and to a lesser extend the I-cache bloat, though that's
probably minimal.  In the past I've been able to demonstrate
considerably better micro-performance, and modestly better
macro-performance, in the bge and em drivers from optimizing cache
efficiency in busdma.

> 
> Which devices have fast enough i/o for the extra indirection to matter?
> bge tries hard to avoid all PCI access in time-critical code.  I think
> we reduced the PCI accesses to 1 PCI write per interrupt.  Most device
> accesses for bge use host memory which is DMAed to/from by the hardware,
> so bus space doesn't apply.  This type of access seems to be the best
> or only way for a PCI device to go fast enough (though it is still too
> slow on at least i386 since the DMA always causes cache misses).
> 
> Bruce

I'm thinking of 10Gb ethernet drivers, which have already shown to fully
saturate the host CPU long before wire bandwidth is filled.  I'm only
familiar with cxgb and mxge; cxgb does a single bus write per
transaction, while mxge cheats and aliases the card memory registers via
rman_get_virtual(), making the single-instruction-access automatic =-)

Scott

From owner-svn-src-head@FreeBSD.ORG  Wed Oct 15 10:10:35 2008
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0BACB10656A2;
	Wed, 15 Oct 2008 10:10:35 +0000 (UTC)
	(envelope-from brde@optusnet.com.au)
Received: from mail02.syd.optusnet.com.au (mail02.syd.optusnet.com.au
	[211.29.132.183])
	by mx1.freebsd.org (Postfix) with ESMTP id 96F528FC19;
	Wed, 15 Oct 2008 10:10:34 +0000 (UTC)
	(envelope-from brde@optusnet.com.au)
Received: from c211-30-84-14.carlnfd3.nsw.optusnet.com.au
	(c211-30-84-14.carlnfd3.nsw.optusnet.com.au [211.30.84.14])
	by mail02.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id
	m9FAALnF012290
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Wed, 15 Oct 2008 21:10:24 +1100
Date: Wed, 15 Oct 2008 20:10:21 +1000 (EST)
From: Bruce Evans 
X-X-Sender: bde@delplex.bde.org
To: Max Laier 
In-Reply-To: <200810141649.04834.max@love2party.net>
Message-ID: <20081015195521.J43361@delplex.bde.org>
References: <200810141226.m9ECQtPW006469@svn.freebsd.org>
	<48F4A9A5.8020605@inse.ru> <200810141649.04834.max@love2party.net>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Cc: Maxim Konovalov , svn-src-head@FreeBSD.org,
	svn-src-all@FreeBSD.org, Roman Kurakin ,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r183881 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 15 Oct 2008 10:10:35 -0000

On Tue, 14 Oct 2008, Max Laier wrote:

> On Tuesday 14 October 2008 16:16:05 Roman Kurakin wrote:
>>> ...
>>> Log:
>>>   o Reformat ipfw nat get|setsockopt code to look it  more
>>>   style(9) compliant.  No functional changes.
>>>
>>> Modified:
>>>   head/sys/netinet/ip_fw2.c
>>>
>>> Modified: head/sys/netinet/ip_fw2.c
>>> =========================================================================
>>> ===== --- head/sys/netinet/ip_fw2.c	Tue Oct 14 10:23:11 2008	(r183880) +++
>>> head/sys/netinet/ip_fw2.c	Tue Oct 14 12:26:55 2008	(r183881) @@ -4385,49
>>> +4385,52 @@ ipfw_ctl(struct sockopt *sopt)
>>>  		break;
>>>
>>>  	case IP_FW_NAT_CFG:
>>> -	{
>>> -		if (IPFW_NAT_LOADED)
>>> -			error = ipfw_nat_cfg_ptr(sopt);
>>> -		else {
>>> -			printf("IP_FW_NAT_CFG: ipfw_nat not present, please load it.\n");
>>> -			error = EINVAL;
>>> +		{
>>> +			if (IPFW_NAT_LOADED)
>>> +				error = ipfw_nat_cfg_ptr(sopt);
>>> ...
>>
>> IMHO such indention does not add any usefulness, but increases indention
>> level that is already very high.
>> Also I do not see strict contradiction to the style(9), but probably I
>> am not reading the most current style(9).

style(9) certainly requires indentation for each level of {}.

> The additional scope is absolutely unnecessary here and should be dropped -
> IMHO.  See case IP_FW_RESETLOG and above.

The bogus {} are probably left over from another style bug -- nested
declarations.  One reason that style(9) forbids nested declarations is
that they require the extra scope (except now using C99 (*)).  Too-large
case statements sometimes want to use different local variables for
each case.  To prevent the indentation reaching column 800, the formatting
in the original version of the above is sometimes used.  But this is just
abnother layer of style bugs if the case statement doesn't even have local
variables.

(*) In C99, you can write:

 	int foo;
 	use (foo);

too easily and not even notice that to properly violate style(9)'s nesting
rule you should have written:

 	{				/* bletch */
 		int foo;

 		use (foo);
 	}

or that to not violate style(9) you should have written:

 	int a, b, c, d, e, f, foo, ...;	/* sort foo into function's decls */
 	...
 	use(foo);

style(9) doesn't allow the C99 declaration since C99 hasn't noticed that
C99 exists.

Bruce

From owner-svn-src-head@FreeBSD.ORG  Wed Oct 15 12:02:32 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6E163106568A;
	Wed, 15 Oct 2008 12:02:32 +0000 (UTC)
	(envelope-from edwin@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5B5F88FC34;
	Wed, 15 Oct 2008 12:02:32 +0000 (UTC)
	(envelope-from edwin@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9FC2WOi033267;
	Wed, 15 Oct 2008 12:02:32 GMT (envelope-from edwin@svn.freebsd.org)
Received: (from edwin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9FC2WPL033266;
	Wed, 15 Oct 2008 12:02:32 GMT (envelope-from edwin@svn.freebsd.org)
Message-Id: <200810151202.m9FC2WPL033266@svn.freebsd.org>
From: Edwin Groothuis 
Date: Wed, 15 Oct 2008 12:02:32 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183912 - head/release/doc/en_US.ISO8859-1/relnotes
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 15 Oct 2008 12:02:32 -0000

Author: edwin
Date: Wed Oct 15 12:02:32 2008
New Revision: 183912
URL: http://svn.freebsd.org/changeset/base/183912

Log:
  The timezone information databases has been updated to tzdata2008h.

Modified:
  head/release/doc/en_US.ISO8859-1/relnotes/article.sgml

Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.sgml
==============================================================================
--- head/release/doc/en_US.ISO8859-1/relnotes/article.sgml	Wed Oct 15 06:31:37 2008	(r183911)
+++ head/release/doc/en_US.ISO8859-1/relnotes/article.sgml	Wed Oct 15 12:02:32 2008	(r183912)
@@ -455,8 +455,8 @@
       8.14.1 to 8.14.3.
 
     The timezone database has been updated from
-      the tzdata2007h release to
-      the tzdata2008b release.
+      the tzdata2008b release to
+      the tzdata2008h release.
 
     WPA Supplicant has been
       updated from 0.5.8 to 0.5.10.

From owner-svn-src-head@FreeBSD.ORG  Wed Oct 15 14:02:12 2008
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A6FCB106568B;
	Wed, 15 Oct 2008 14:02:12 +0000 (UTC) (envelope-from des@des.no)
Received: from tim.des.no (tim.des.no [194.63.250.121])
	by mx1.freebsd.org (Postfix) with ESMTP id 602848FC19;
	Wed, 15 Oct 2008 14:02:12 +0000 (UTC) (envelope-from des@des.no)
Received: from ds4.des.no (des.no [84.49.246.2])
	by smtp.des.no (Postfix) with ESMTP id 9832C6D434;
	Wed, 15 Oct 2008 14:02:10 +0000 (UTC)
Received: by ds4.des.no (Postfix, from userid 1001)
	id 822CF844BA; Wed, 15 Oct 2008 16:02:10 +0200 (CEST)
From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= 
To: Bruce Evans 
References: <200810141226.m9ECQtPW006469@svn.freebsd.org>
	<48F4A9A5.8020605@inse.ru> <200810141649.04834.max@love2party.net>
	<20081015195521.J43361@delplex.bde.org>
Date: Wed, 15 Oct 2008 16:02:10 +0200
In-Reply-To: <20081015195521.J43361@delplex.bde.org> (Bruce Evans's message of
	"Wed, 15 Oct 2008 20:10:21 +1000 (EST)")
Message-ID: <86abd60xel.fsf@ds4.des.no>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Cc: Maxim Konovalov , Roman Kurakin ,
	svn-src-all@FreeBSD.org, src-committers@FreeBSD.org,
	svn-src-head@FreeBSD.org, Max Laier 
Subject: Re: svn commit: r183881 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 15 Oct 2008 14:02:12 -0000

Bruce Evans  writes:
> style(9) doesn't allow the C99 declaration since C99 hasn't noticed that
> C99 exists.

I vote for style(9)'s continued ignorance of C99 declarations.

The only case in which I can see a net benefit is for one-off loop
variables, and even there the benefit is probably not sufficient to
justify the loss of compatibility with older compilers.

DES
--=20
Dag-Erling Sm=C3=B8rgrav - des@des.no

From owner-svn-src-head@FreeBSD.ORG  Wed Oct 15 15:54:33 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9C0DE1065687;
	Wed, 15 Oct 2008 15:54:33 +0000 (UTC)
	(envelope-from kensmith@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 890318FC19;
	Wed, 15 Oct 2008 15:54:33 +0000 (UTC)
	(envelope-from kensmith@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9FFsXk8037548;
	Wed, 15 Oct 2008 15:54:33 GMT
	(envelope-from kensmith@svn.freebsd.org)
Received: (from kensmith@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9FFsXGK037543;
	Wed, 15 Oct 2008 15:54:33 GMT
	(envelope-from kensmith@svn.freebsd.org)
Message-Id: <200810151554.m9FFsXGK037543@svn.freebsd.org>
From: Ken Smith 
Date: Wed, 15 Oct 2008 15:54:33 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183921 - head/usr.sbin/sysinstall
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 15 Oct 2008 15:54:33 -0000

Author: kensmith
Date: Wed Oct 15 15:54:33 2008
New Revision: 183921
URL: http://svn.freebsd.org/changeset/base/183921

Log:
  Package installation is handled by starting off with the list of packages
  the user selected and then recursively installing their dependencies, finally
  installing the ones the user selected after the recursion unwinds.  Since
  users often select "high-level" packages that are on a higher numbered
  disc for the multi-volume release CDROMS this resulted in excessive disc
  swapping while installing things like kde, gnome, etc.
  
  Cut down on disc swapping by iterating through the disc volumes one at a
  time if we notice the package set is on multiple volumes.  If a package
  is on a higher volume don't install it yet, but still "process it" so we
  get its dependencies installed.  Because of the way the package sets for
  releases get assembled we're guaranteed dependencies will be on the same
  volume or lower.
  
  Reviewed by:	jhb
  MFC after:	1 week

Modified:
  head/usr.sbin/sysinstall/config.c
  head/usr.sbin/sysinstall/globals.c
  head/usr.sbin/sysinstall/index.c
  head/usr.sbin/sysinstall/package.c
  head/usr.sbin/sysinstall/sysinstall.h

Modified: head/usr.sbin/sysinstall/config.c
==============================================================================
--- head/usr.sbin/sysinstall/config.c	Wed Oct 15 15:39:20 2008	(r183920)
+++ head/usr.sbin/sysinstall/config.c	Wed Oct 15 15:54:33 2008	(r183921)
@@ -737,6 +737,7 @@ configPackages(dialogMenuItem *self)
 
     while (1) {
 	int ret, pos, scroll;
+	int current, low, high;
 
 	/* Bring up the packages menu */
 	pos = scroll = 0;
@@ -751,8 +752,14 @@ configPackages(dialogMenuItem *self)
 	    else if (DITEM_STATUS(ret) != DITEM_FAILURE) {
 		dialog_clear();
 		restoreflag = 1;
-		for (tmp = Plist.kids; tmp && tmp->name; tmp = tmp->next)
-		    (void)index_extract(mediaDevice, &Top, tmp, FALSE);
+		if (have_volumes) {
+		    low = low_volume;
+		    high = high_volume;
+		} else
+		    low = high = 0;
+		for (current = low; current <= high; current++)
+		    for (tmp = Plist.kids; tmp && tmp->name; tmp = tmp->next)
+		        (void)index_extract(mediaDevice, &Top, tmp, FALSE, current);
 		break;
 	    }
 	}

Modified: head/usr.sbin/sysinstall/globals.c
==============================================================================
--- head/usr.sbin/sysinstall/globals.c	Wed Oct 15 15:39:20 2008	(r183920)
+++ head/usr.sbin/sysinstall/globals.c	Wed Oct 15 15:54:33 2008	(r183921)
@@ -48,10 +48,13 @@ Boolean		DialogActive;	/* Is libdialog i
 Boolean		ColorDisplay;	/* Are we on a color display? */
 Boolean		OnVTY;		/* Are we on a VTY? */
 Boolean		Restarting;	/* Are we restarting sysinstall? */
+Boolean		have_volumes;	/* Media has more than one volume. */
 Variable	*VarHead;	/* The head of the variable chain */
 Device		*mediaDevice;	/* Where we're installing from */
 int		BootMgr;	/* Which boot manager we're using */
 int		StatusLine;	/* Where to stick our status messages */
+int		low_volume;	/* Lowest volume number */
+int		high_volume;	/* Highest volume number */
 jmp_buf		BailOut;	/* Beam me up, scotty! The natives are pissed! */
 
 Chunk		*HomeChunk;

Modified: head/usr.sbin/sysinstall/index.c
==============================================================================
--- head/usr.sbin/sysinstall/index.c	Wed Oct 15 15:39:20 2008	(r183920)
+++ head/usr.sbin/sysinstall/index.c	Wed Oct 15 15:54:33 2008	(r183921)
@@ -225,7 +225,17 @@ new_index(char *name, char *pathto, char
     tmp->deps =		_strdup(deps);
     tmp->depc =		0;
     tmp->installed =	package_installed(name);
+    tmp->vol_checked =	0;
     tmp->volume =	volume;
+    if (volume != 0) {
+	have_volumes = TRUE;
+	if (low_volume == 0)
+	    low_volume = volume;
+	else if (low_volume > volume)
+	    low_volume = volume;
+	if (high_volume < volume)
+	    high_volume = volume;
+    }
     return tmp;
 }
 
@@ -682,9 +692,11 @@ recycle:
 }
 
 int
-index_extract(Device *dev, PkgNodePtr top, PkgNodePtr who, Boolean depended)
+index_extract(Device *dev, PkgNodePtr top, PkgNodePtr who, Boolean depended,
+    int current_volume)
 {
     int status = DITEM_SUCCESS;
+    Boolean notyet = FALSE;
     PkgNodePtr tmp2;
     IndexEntryPtr id = who->data;
     WINDOW *w;
@@ -699,7 +711,7 @@ index_extract(Device *dev, PkgNodePtr to
      * a certain faulty INDEX file. 
      */
 
-    if (id->installed == 1)
+    if (id->installed == 1 || (have_volumes && id->vol_checked == current_volume))
 	return DITEM_SUCCESS;
 
     w = savescr();
@@ -712,9 +724,13 @@ index_extract(Device *dev, PkgNodePtr to
 	    if ((cp2 = index(cp, ' ')) != NULL)
 		*cp2 = '\0';
 	    if ((tmp2 = index_search(top, cp, NULL)) != NULL) {
-		status = index_extract(dev, top, tmp2, TRUE);
+		status = index_extract(dev, top, tmp2, TRUE, current_volume);
 		if (DITEM_STATUS(status) != DITEM_SUCCESS) {
-		    if (variable_get(VAR_NO_CONFIRM))
+		    /* package probably on a future disc volume */
+		    if (status & DITEM_CONTINUE) {
+			status = DITEM_SUCCESS;
+			notyet = TRUE;
+		    } else if (variable_get(VAR_NO_CONFIRM))
 			msgNotify("Loading of dependent package %s failed", cp);
 		    else
 			msgConfirm("Loading of dependent package %s failed", cp);
@@ -732,10 +748,38 @@ index_extract(Device *dev, PkgNodePtr to
 		cp = NULL;
 	}
     }
-    /* Done with the deps?  Load the real m'coy */
+
+    /*
+     * If iterating through disc volumes one at a time indicate failure if
+     * dependency install failed due to package being on a higher volume
+     * numbered disc, but that we should continue anyway.  Note that this
+     * package has already been processed for this disc volume so we don't
+     * need to do it again.
+     */
+
+    if (notyet) {
+    	restorescr(w);
+	id->vol_checked = current_volume;
+	return DITEM_FAILURE | DITEM_CONTINUE;
+    }
+
+    /*
+     * Done with the deps?  Try to load the real m'coy.  If iterating
+     * through a multi-volume disc set fail the install if the package
+     * is on a higher numbered volume to cut down on disc switches the
+     * user needs to do, but indicate caller should continue processing
+     * despite error return.  Note this package was processed for the
+     * current disc being checked.
+     */
+
     if (DITEM_STATUS(status) == DITEM_SUCCESS) {
 	/* Prompt user if the package is not available on the current volume. */
 	if(mediaDevice->type == DEVICE_TYPE_CDROM) {
+	    if (current_volume != 0 && id->volume > current_volume) {
+		restorescr(w);
+		id->vol_checked = current_volume;
+		return DITEM_FAILURE | DITEM_CONTINUE;
+	    }
 	    while (id->volume != dev->volume) {
 		if (!msgYesNo("This is disc #%d.  Package %s is on disc #%d\n"
 			  "Would you like to switch discs now?\n", dev->volume,
@@ -801,6 +845,8 @@ index_initialize(char *path)
     if (!index_initted) {
 	w = savescr();
 	dialog_clear_norefresh();
+	have_volumes = FALSE;
+	low_volume = high_volume = 0;
 
 	/* Got any media? */
 	if (!mediaVerify()) {

Modified: head/usr.sbin/sysinstall/package.c
==============================================================================
--- head/usr.sbin/sysinstall/package.c	Wed Oct 15 15:39:20 2008	(r183920)
+++ head/usr.sbin/sysinstall/package.c	Wed Oct 15 15:54:33 2008	(r183921)
@@ -69,7 +69,7 @@ package_add(char *name)
 
     tmp = index_search(&Top, name, &tmp);
     if (tmp)
-	return index_extract(mediaDevice, &Top, tmp, FALSE);
+	return index_extract(mediaDevice, &Top, tmp, FALSE, 0);
     else {
 	msgConfirm("Sorry, package %s was not found in the INDEX.", name);
 	return DITEM_FAILURE;

Modified: head/usr.sbin/sysinstall/sysinstall.h
==============================================================================
--- head/usr.sbin/sysinstall/sysinstall.h	Wed Oct 15 15:39:20 2008	(r183920)
+++ head/usr.sbin/sysinstall/sysinstall.h	Wed Oct 15 15:54:33 2008	(r183921)
@@ -384,6 +384,7 @@ typedef struct _indexEntry {	/* A single
     char *deps;			/* packages this depends on	*/
     int  depc;			/* how many depend on me	*/
     int  installed;		/* indicates if it is installed */
+    int  vol_checked;		/* disc volume last checked for */
     char *maintainer;		/* maintainer			*/
     unsigned int volume;	/* Volume of package            */
 } IndexEntry;
@@ -416,6 +417,7 @@ extern Boolean		RunningAsInit;		/* Are w
 extern Boolean		DialogActive;		/* Is the dialog() stuff up?			*/
 extern Boolean		ColorDisplay;		/* Are we on a color display?			*/
 extern Boolean		OnVTY;			/* On a syscons VTY?				*/
+extern Boolean		have_volumes;		/* Media has multiple volumes                   */
 extern Variable		*VarHead;		/* The head of the variable chain		*/
 extern Device		*mediaDevice;		/* Where we're getting our distribution from	*/
 extern unsigned int	Dists;			/* Which distributions we want			*/
@@ -479,6 +481,8 @@ extern int              FixItMode;      
 extern const char *	StartName;		/* Which name we were started as */
 extern const char *	ProgName;		/* Program's proper name */
 extern int		NCpus;			/* # cpus on machine */
+extern int		low_volume;		/* Lowest volume number */
+extern int		high_volume;		/* Highest volume number */
 
 /* Important chunks. */
 extern Chunk *HomeChunk;
@@ -670,7 +674,7 @@ void		index_init(PkgNodePtr top, PkgNode
 void		index_node_free(PkgNodePtr top, PkgNodePtr plist);
 void		index_sort(PkgNodePtr top);
 void		index_print(PkgNodePtr top, int level);
-int		index_extract(Device *dev, PkgNodePtr top, PkgNodePtr who, Boolean depended);
+int		index_extract(Device *dev, PkgNodePtr top, PkgNodePtr who, Boolean depended, int current_volume);
 int		index_initialize(char *path);
 PkgNodePtr	index_search(PkgNodePtr top, char *str, PkgNodePtr *tp);
 

From owner-svn-src-head@FreeBSD.ORG  Wed Oct 15 16:58:36 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3BF1E1065686;
	Wed, 15 Oct 2008 16:58:36 +0000 (UTC) (envelope-from ed@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 283888FC0C;
	Wed, 15 Oct 2008 16:58:36 +0000 (UTC) (envelope-from ed@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9FGwaMF038857;
	Wed, 15 Oct 2008 16:58:36 GMT (envelope-from ed@svn.freebsd.org)
Received: (from ed@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9FGwaYZ038854;
	Wed, 15 Oct 2008 16:58:36 GMT (envelope-from ed@svn.freebsd.org)
Message-Id: <200810151658.m9FGwaYZ038854@svn.freebsd.org>
From: Ed Schouten 
Date: Wed, 15 Oct 2008 16:58:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183922 - in head: share/man/man4 sys/kern sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 15 Oct 2008 16:58:36 -0000

Author: ed
Date: Wed Oct 15 16:58:35 2008
New Revision: 183922
URL: http://svn.freebsd.org/changeset/base/183922

Log:
  Import some improvements to the TTY code from the MPSAFE TTY branch.
  
  - Change the ddb(4) commands to be more useful (by thompsa@):
    - `show ttys' is now called `show all ttys'. This command will now
      also display the address where the TTY data structure resides.
    - Add `show tty ', which dumps the TTY in a readable form.
  
  - Place an upper bound on the TTY buffer sizes. Some drivers do not want
    to care about baud rates. Protect these drivers by preventing the TTY
    buffers from getting enormous. Right now we'll just clamp it to 64K,
    which is pretty high, taking into account that these buffers are only
    used by the built-in discipline.
  
  - Only call ttydev_leave() when needed. Back in April/May the TTY
    reference counting mechanism was a little different, which required us
    to call ttydev_leave() each time we finished a cdev operation.
    Nowadays we only need to call ttydev_leave() when we really mark it as
    being closed.
  
  - Improve return codes of read() and write() on TTY device nodes.
  
  - Make sure we really wake up all blocked threads when the driver calls
    tty_rel_gone(). There were some possible code paths where we didn't
    properly wake up any readers/writers.
  
  - Add extra assertions to prevent sleeping on a TTY that has been
    abandoned by the driver.
  
  - Use ttydev_cdevsw as a more reliable method to figure out whether a
    device node is a real TTY device node.
  
  Obtained from:	//depot/projects/mpsafetty/...
  Reviewed by:	thompsa

Modified:
  head/share/man/man4/ddb.4
  head/sys/kern/tty.c
  head/sys/sys/tty.h

Modified: head/share/man/man4/ddb.4
==============================================================================
--- head/share/man/man4/ddb.4	Wed Oct 15 15:54:33 2008	(r183921)
+++ head/share/man/man4/ddb.4	Wed Oct 15 16:58:35 2008	(r183922)
@@ -540,6 +540,13 @@ modifier will alter the display to show 
 addresses for the process and not show other information.
 .\"
 .Pp
+.It Ic show Cm all ttys
+Show all TTY's within the system.
+Output is similar to
+.Xr pstat 8 ,
+but also includes the address of the TTY structure.
+.\"
+.Pp
 .It Ic show Cm allchains
 Show the same information like "show lockchain" does, but
 for every thread in the system.
@@ -963,10 +970,8 @@ Backtrace.
 .El
 .\"
 .Pp
-.It Ic show Cm ttys
-Show all TTY's within the system.
-Output is similar to
-.Xr pstat 8 .
+.It Ic show Cm tty Ar addr
+Display the contents of a TTY structure in a readable form.
 .\"
 .Pp
 .It Ic show Cm turnstile Ar addr

Modified: head/sys/kern/tty.c
==============================================================================
--- head/sys/kern/tty.c	Wed Oct 15 15:54:33 2008	(r183921)
+++ head/sys/kern/tty.c	Wed Oct 15 16:58:35 2008	(r183922)
@@ -92,21 +92,23 @@ static unsigned int tty_list_count = 0;
  * Set TTY buffer sizes.
  */
 
+#define	TTYBUF_MAX	65536
+
 static void
 tty_watermarks(struct tty *tp)
 {
-	speed_t sp;
+	size_t bs;
 
 	/* Provide an input buffer for 0.2 seconds of data. */
-	sp = MAX(tp->t_termios.c_ispeed, 0);
-	ttyinq_setsize(&tp->t_inq, tp, sp / 5);
+	bs = MIN(tp->t_termios.c_ispeed / 5, TTYBUF_MAX);
+	ttyinq_setsize(&tp->t_inq, tp, bs);
 
 	/* Set low watermark at 10% (when 90% is available). */
 	tp->t_inlow = (ttyinq_getsize(&tp->t_inq) * 9) / 10;
 
 	/* Provide an ouput buffer for 0.2 seconds of data. */
-	sp = MAX(tp->t_termios.c_ospeed, 0);
-	ttyoutq_setsize(&tp->t_outq, tp, sp / 5);
+	bs = MIN(tp->t_termios.c_ospeed / 5, TTYBUF_MAX);
+	ttyoutq_setsize(&tp->t_outq, tp, bs);
 
 	/* Set low watermark at 10% (when 90% is available). */
 	tp->t_outlow = (ttyoutq_getsize(&tp->t_outq) * 9) / 10;
@@ -133,11 +135,12 @@ tty_drain(struct tty *tp)
 }
 
 /*
- * Because the revoke() call already calls d_close() without making sure
- * all threads are purged from the TTY, we can only destroy the buffers
- * and such when the last thread leaves the TTY. ttydev_enter() and
- * ttydev_leave() are called from within the cdev functions, to make
- * sure we can garbage collect the TTY.
+ * Though ttydev_enter() and ttydev_leave() seem to be related, they
+ * don't have to be used together. ttydev_enter() is used by the cdev
+ * operations to prevent an actual operation from being processed when
+ * the TTY has been abandoned. ttydev_leave() is used by ttydev_open()
+ * and ttydev_close() to determine whether per-TTY data should be
+ * deallocated.
  */
 
 static __inline int
@@ -287,6 +290,7 @@ ttydev_open(struct cdev *dev, int oflags
 
 done:	tp->t_flags &= ~TF_OPENCLOSE;
 	ttydev_leave(tp);
+
 	return (error);
 }
 
@@ -378,22 +382,23 @@ ttydev_read(struct cdev *dev, struct uio
 
 	error = ttydev_enter(tp);
 	if (error)
-		return (0);
+		goto done;
 
 	error = tty_wait_background(tp, curthread, SIGTTIN);
-	if (error)
+	if (error) {
+		tty_unlock(tp);
 		goto done;
+	}
 
 	error = ttydisc_read(tp, uio, ioflag);
-done:	ttydev_leave(tp);
+	tty_unlock(tp);
 
 	/*
-	 * The read() and write() calls should not throw an error when
-	 * the device is ripped offline.
+	 * The read() call should not throw an error when the device is
+	 * being destroyed. Silently convert it to an EOF.
 	 */
-	if (error == ENXIO)
-		return (0);
-
+done:	if (error == ENXIO)
+		error = 0;
 	return (error);
 }
 
@@ -405,23 +410,18 @@ ttydev_write(struct cdev *dev, struct ui
 
 	error = ttydev_enter(tp);
 	if (error)
-		return (0);
+		return (error);
 
 	if (tp->t_termios.c_lflag & TOSTOP) {
 		error = tty_wait_background(tp, curthread, SIGTTOU);
-		if (error)
-			goto done;
+		if (error) {
+			tty_unlock(tp);
+			return (error);
+		}
 	}
 
 	error = ttydisc_write(tp, uio, ioflag);
-done:	ttydev_leave(tp);
-
-	/*
-	 * The read() and write() calls should not throw an error when
-	 * the device is ripped offline.
-	 */
-	if (error == ENXIO)
-		return (0);
+	tty_unlock(tp);
 
 	return (error);
 }
@@ -479,7 +479,7 @@ ttydev_ioctl(struct cdev *dev, u_long cm
 	}
 
 	error = tty_ioctl(tp, cmd, data, td);
-done:	ttydev_leave(tp);
+done:	tty_unlock(tp);
 
 	return (error);
 }
@@ -518,7 +518,7 @@ ttydev_poll(struct cdev *dev, int events
 			selrecord(td, &tp->t_outpoll);
 	}
 
-	ttydev_leave(tp);
+	tty_unlock(tp);
 
 	return (revents);
 }
@@ -535,7 +535,7 @@ ttydev_mmap(struct cdev *dev, vm_offset_
 	if (error)
 		return (-1);
 	error = ttydevsw_mmap(tp, offset, paddr, nprot);
-	ttydev_leave(tp);
+	tty_unlock(tp);
 
 	return (error);
 }
@@ -623,7 +623,7 @@ ttydev_kqfilter(struct cdev *dev, struct
 		break;
 	}
 
-	ttydev_leave(tp);
+	tty_unlock(tp);
 	return (error);
 }
 
@@ -973,7 +973,8 @@ tty_rel_gone(struct tty *tp)
 	/* Simulate carrier removal. */
 	ttydisc_modem(tp, 0);
 
-	/* Wake up misc. blocked threads. */
+	/* Wake up all blocked threads. */
+	tty_wakeup(tp, FREAD|FWRITE);
 	cv_broadcast(&tp->t_bgwait);
 	cv_broadcast(&tp->t_dcdwait);
 
@@ -1189,6 +1190,7 @@ tty_wait(struct tty *tp, struct cv *cv)
 	tty_lock_assert(tp, MA_OWNED|MA_NOTRECURSED);
 #endif
 	tty_lock_assert(tp, MA_OWNED);
+	MPASS(!tty_gone(tp));
 
 	error = cv_wait_sig(cv, tp->t_mtx);
 
@@ -1214,6 +1216,7 @@ tty_timedwait(struct tty *tp, struct cv 
 	tty_lock_assert(tp, MA_OWNED|MA_NOTRECURSED);
 #endif
 	tty_lock_assert(tp, MA_OWNED);
+	MPASS(!tty_gone(tp));
 
 	error = cv_timedwait_sig(cv, tp->t_mtx, hz);
 
@@ -1690,7 +1693,7 @@ ttyhook_register(struct tty **rtp, struc
 	cdp = dev_refthread(dev);
 	if (cdp == NULL)
 		goto done1;
-	if ((cdp->d_flags & D_TTY) == 0)
+	if (cdp != &ttydev_cdevsw)
 		goto done2;
 	tp = dev->si_drv1;
 
@@ -1741,6 +1744,7 @@ ttyhook_unregister(struct tty *tp)
 #include "opt_ddb.h"
 #ifdef DDB
 #include 
+#include 
 
 static struct {
 	int flag;
@@ -1776,14 +1780,134 @@ static struct {
 	{ 0,	       '\0' },
 };
 
+#define	TTY_FLAG_BITS \
+	"\20\1NOPREFIX\2INITLOCK\3CALLOUT\4OPENED_IN\5OPENED_OUT\6GONE" \
+	"\7OPENCLOSE\10ASYNC\11LITERAL\12HIWAT_IN\13HIWAT_OUT\14STOPPED" \
+	"\15EXCLUDE\16BYPASS\17ZOMBIE\20HOOK"
+
+#define DB_PRINTSYM(name, addr) \
+	db_printf("%s  " #name ": ", sep); \
+	db_printsym((db_addr_t) addr, DB_STGY_ANY); \
+	db_printf("\n");
+
+static void
+_db_show_devsw(const char *sep, const struct ttydevsw *tsw)
+{
+	db_printf("%sdevsw: ", sep);
+	db_printsym((db_addr_t)tsw, DB_STGY_ANY);
+	db_printf(" (%p)\n", tsw);
+	DB_PRINTSYM(open, tsw->tsw_open);
+	DB_PRINTSYM(close, tsw->tsw_close);
+	DB_PRINTSYM(outwakeup, tsw->tsw_outwakeup);
+	DB_PRINTSYM(inwakeup, tsw->tsw_inwakeup);
+	DB_PRINTSYM(ioctl, tsw->tsw_ioctl);
+	DB_PRINTSYM(param, tsw->tsw_param);
+	DB_PRINTSYM(modem, tsw->tsw_modem);
+	DB_PRINTSYM(mmap, tsw->tsw_mmap);
+	DB_PRINTSYM(pktnotify, tsw->tsw_pktnotify);
+	DB_PRINTSYM(free, tsw->tsw_free);
+}
+static void
+_db_show_hooks(const char *sep, const struct ttyhook *th)
+{
+	db_printf("%shook: ", sep);
+	db_printsym((db_addr_t)th, DB_STGY_ANY);
+	db_printf(" (%p)\n", th);
+	if (th == NULL)
+		return;
+	DB_PRINTSYM(rint, th->th_rint);
+	DB_PRINTSYM(rint_bypass, th->th_rint_bypass);
+	DB_PRINTSYM(rint_done, th->th_rint_done);
+	DB_PRINTSYM(rint_poll, th->th_rint_poll);
+	DB_PRINTSYM(getc_inject, th->th_getc_inject);
+	DB_PRINTSYM(getc_capture, th->th_getc_capture);
+	DB_PRINTSYM(getc_poll, th->th_getc_poll);
+	DB_PRINTSYM(close, th->th_close);
+}
+
+static void
+_db_show_termios(const char *name, const struct termios *t)
+{
+
+	db_printf("%s: iflag 0x%x oflag 0x%x cflag 0x%x "
+	    "lflag 0x%x ispeed %u ospeed %u\n", name,
+	    t->c_iflag, t->c_oflag, t->c_cflag, t->c_lflag,
+	    t->c_ispeed, t->c_ospeed);
+}
+
 /* DDB command to show TTY statistics. */
-DB_SHOW_COMMAND(ttys, db_show_ttys)
+DB_SHOW_COMMAND(tty, db_show_tty)
+{
+	struct tty *tp;
+
+	if (!have_addr) {
+		db_printf("usage: show tty \n");
+		return;
+	}
+	tp = (struct tty *)addr;
+
+	db_printf("0x%p: %s\n", tp, tty_devname(tp));
+	db_printf("\tmtx: %p\n", tp->t_mtx);
+	db_printf("\tflags: %b\n", tp->t_flags, TTY_FLAG_BITS);
+	db_printf("\trevokecnt: %u\n", tp->t_revokecnt);
+
+	/* Buffering mechanisms. */
+	db_printf("\tinq: %p begin %u linestart %u reprint %u end %u "
+	    "nblocks %u quota %u\n", &tp->t_inq, tp->t_inq.ti_begin,
+	    tp->t_inq.ti_linestart, tp->t_inq.ti_reprint, tp->t_inq.ti_end,
+	    tp->t_inq.ti_nblocks, tp->t_inq.ti_quota);
+	db_printf("\toutq: %p begin %u end %u nblocks %u quota %u\n",
+	    &tp->t_outq, tp->t_outq.to_begin, tp->t_outq.to_end,
+	    tp->t_outq.to_nblocks, tp->t_outq.to_quota);
+	db_printf("\tinlow: %zu\n", tp->t_inlow);
+	db_printf("\toutlow: %zu\n", tp->t_outlow);
+	_db_show_termios("\ttermios", &tp->t_termios);
+	db_printf("\twinsize: row %u col %u xpixel %u ypixel %u\n",
+	    tp->t_winsize.ws_row, tp->t_winsize.ws_col,
+	    tp->t_winsize.ws_xpixel, tp->t_winsize.ws_ypixel);
+	db_printf("\tcolumn: %u\n", tp->t_column);
+	db_printf("\twritepos: %u\n", tp->t_writepos);
+	db_printf("\tcompatflags: 0x%x\n", tp->t_compatflags);
+
+	/* Init/lock-state devices. */
+	_db_show_termios("\ttermios_init_in", &tp->t_termios_init_in);
+	_db_show_termios("\ttermios_init_out", &tp->t_termios_init_out);
+	_db_show_termios("\ttermios_lock_in", &tp->t_termios_lock_in);
+	_db_show_termios("\ttermios_lock_out", &tp->t_termios_lock_out);
+
+	/* Hooks */
+	_db_show_devsw("\t", tp->t_devsw);
+	_db_show_hooks("\t", tp->t_hook);
+
+	/* Process info. */
+	db_printf("\tpgrp: %p gid %d jobc %d\n", tp->t_pgrp,
+	    tp->t_pgrp ? tp->t_pgrp->pg_id : 0,
+	    tp->t_pgrp ? tp->t_pgrp->pg_jobc : 0);
+	db_printf("\tsession: %p", tp->t_session);
+	if (tp->t_session != NULL)
+	    db_printf(" count %u leader %p tty %p sid %d login %s",
+		tp->t_session->s_count, tp->t_session->s_leader,
+		tp->t_session->s_ttyp, tp->t_session->s_sid,
+		tp->t_session->s_login);
+	db_printf("\n");
+	db_printf("\tsessioncnt: %u\n", tp->t_sessioncnt);
+	db_printf("\tdevswsoftc: %p\n", tp->t_devswsoftc);
+	db_printf("\thooksoftc: %p\n", tp->t_hooksoftc);
+	db_printf("\tdev: %p\n", tp->t_dev);
+}
+
+/* DDB command to list TTYs. */
+DB_SHOW_ALL_COMMAND(ttys, db_show_all_ttys)
 {
 	struct tty *tp;
 	size_t isiz, osiz;
 	int i, j;
 
 	/* Make the output look like `pstat -t'. */
+	db_printf("PTR        ");
+#if defined(__LP64__)
+	db_printf("        ");
+#endif
 	db_printf("      LINE   INQ  CAN  LIN  LOW  OUTQ  USE  LOW   "
 	    "COL  SESS  PGID STATE\n");
 
@@ -1791,7 +1915,8 @@ DB_SHOW_COMMAND(ttys, db_show_ttys)
 		isiz = tp->t_inq.ti_nblocks * TTYINQ_DATASIZE;
 		osiz = tp->t_outq.to_nblocks * TTYOUTQ_DATASIZE;
 
-		db_printf("%10s %5zu %4u %4u %4zu %5zu %4u %4zu %5u %5d %5d ",
+		db_printf("%p %10s %5zu %4u %4u %4zu %5zu %4u %4zu %5u %5d %5d ",
+		    tp,
 		    tty_devname(tp),
 		    isiz,
 		    tp->t_inq.ti_linestart - tp->t_inq.ti_begin,

Modified: head/sys/sys/tty.h
==============================================================================
--- head/sys/sys/tty.h	Wed Oct 15 15:54:33 2008	(r183921)
+++ head/sys/sys/tty.h	Wed Oct 15 16:58:35 2008	(r183922)
@@ -63,6 +63,7 @@ struct tty {
 	struct mtx	t_mtxobj;	/* Per-TTY lock (when not borrowing). */
 	TAILQ_ENTRY(tty) t_list;	/* (l) TTY list entry. */
 	unsigned int	t_flags;	/* (t) Terminal option flags. */
+/* Keep flags in sync with db_show_tty and pstat(8). */
 #define	TF_NOPREFIX	0x0001	/* Don't prepend "tty" to device name. */
 #define	TF_INITLOCK	0x0002	/* Create init/lock state devices. */
 #define	TF_CALLOUT	0x0004	/* Create "cua" devices. */

From owner-svn-src-head@FreeBSD.ORG  Wed Oct 15 19:00:27 2008
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 12997106564A;
	Wed, 15 Oct 2008 19:00:27 +0000 (UTC)
	(envelope-from brde@optusnet.com.au)
Received: from fallbackmx10.syd.optusnet.com.au
	(fallbackmx10.syd.optusnet.com.au [211.29.132.251])
	by mx1.freebsd.org (Postfix) with ESMTP id 00C638FC19;
	Wed, 15 Oct 2008 19:00:25 +0000 (UTC)
	(envelope-from brde@optusnet.com.au)
Received: from mail05.syd.optusnet.com.au (mail05.syd.optusnet.com.au
	[211.29.132.186])
	by fallbackmx10.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id
	m9F9fmx8024212; Wed, 15 Oct 2008 20:41:49 +1100
Received: from c211-30-84-14.carlnfd3.nsw.optusnet.com.au
	(c211-30-84-14.carlnfd3.nsw.optusnet.com.au [211.30.84.14])
	by mail05.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id
	m9F9femV032073
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Wed, 15 Oct 2008 20:41:43 +1100
Date: Wed, 15 Oct 2008 19:41:39 +1000 (EST)
From: Bruce Evans 
X-X-Sender: bde@delplex.bde.org
To: Scott Long 
In-Reply-To: <48F5053D.7070705@samsco.org>
Message-ID: <20081015184833.N43215@delplex.bde.org>
References: <200810142028.m9EKShoL015514@svn.freebsd.org>
	<48F5053D.7070705@samsco.org>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Cc: svn-src-head@FreeBSD.org, Marius Strobl ,
	src-committers@FreeBSD.org, svn-src-all@FreeBSD.org
Subject: Re: svn commit: r183896 - head/sys/dev/bge
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 15 Oct 2008 19:00:27 -0000

On Tue, 14 Oct 2008, Scott Long wrote:

> Marius Strobl wrote:
>> Author: marius
>> Date: Tue Oct 14 20:28:42 2008
>> New Revision: 183896
>> URL: http://svn.freebsd.org/changeset/base/183896
>> 
>> Log:
>>   Use bus_{read,write}_4(9) instead of bus_space_{read,write}_4(9)
>>   in order to get rid of the bus space handle and tag in the softc.
>
> Has anyone looked at the generated code from this interface switch and
> compared it what was getting generated previously?  Way back when,

I just looked at the source code.  This seems to be only a small
pessimization since it involves just one extra indirection and
related loss of optimization possibilities: (sc->sc_bt, sc->sc_bh)
becomes r = sc->sc_br; (r->r_bustag, r->r_bushandle).  In theory,
the compiler could optimize by caching the tag and handle in registers
in either case so that only 1 extra indirection is needed per function,
but I've never seen that being done enough to make much difference.

However, some drivers (e.g., ata) were too stupid to cache sc_bt and
sc_bh, and converting these to use bus_nonspace*() was a relatively large
optimization: r = sc->sc_br; (rman_get_bustag(r), rman_get_bushandle(r))
became r = sc->sc_br; (r->r_bustag, r->r_bushandle).  Since rman_get_bustag()
and rman_get_bushandle() have never been inline, calling both of them
on every bus space access gave enormous code space and instruction
count bloat and corresponding (relatively tiny) runtime bloat.  The
instructions normally run so much faster than the i/o that you can do
hundreds or thousands of them per i/o before noticing the runtime
bloat, and the instruction count bloat here is only about a factor of 20.

> including  made bus_space_read|write_4() compile
> into a direct memory access on machines that supported it.  The dubious
> removal of bus_memio.h and bus_pio.h took away that benefit, and I'm
> afraid that it's only getting worse now.  Bus writes to card memory are
> still very important to high-performance devices and shouldn't be
> pessimized in the name of simpler-looking C code.

I hate the bloat too, but it rarely matters (see above).  I mainly noticed
it using ddb.  Where nice drivers are optimized to use a single instruction
per i/o (or perhaps 2 with minimal bus space bloat), the ones that use
rman_get*() on every i/o take 20+, and with a primitive debugger like ddb
it is painful to even skip over all the function calls.

Which devices have fast enough i/o for the extra indirection to matter?
bge tries hard to avoid all PCI access in time-critical code.  I think
we reduced the PCI accesses to 1 PCI write per interrupt.  Most device
accesses for bge use host memory which is DMAed to/from by the hardware,
so bus space doesn't apply.  This type of access seems to be the best
or only way for a PCI device to go fast enough (though it is still too
slow on at least i386 since the DMA always causes cache misses).

Bruce

From owner-svn-src-head@FreeBSD.ORG  Wed Oct 15 19:24:18 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9122B10656A0;
	Wed, 15 Oct 2008 19:24:18 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7FA518FC1D;
	Wed, 15 Oct 2008 19:24:18 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9FJOIep041310;
	Wed, 15 Oct 2008 19:24:18 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9FJOIlW041309;
	Wed, 15 Oct 2008 19:24:18 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <200810151924.m9FJOIlW041309@svn.freebsd.org>
From: "Bjoern A. Zeeb" 
Date: Wed, 15 Oct 2008 19:24:18 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183923 - head/sys/netinet6
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 15 Oct 2008 19:24:18 -0000

Author: bz
Date: Wed Oct 15 19:24:18 2008
New Revision: 183923
URL: http://svn.freebsd.org/changeset/base/183923

Log:
  Check that the mbuf len is positive (like we do in the v4 case).
  
  Read the other way round this means that even with the checks
  the m_len turned negative in some cases which led to panics.
  The reason to my understanding seems to be that the checks are wrong
  (also for v4) ignoring possible padding when checking cmsg_len or
  padding after data when adjusting the mbuf.
  Doing proper cheks seems to break applications like named so
  further investigation and regression tests are needed.
  
  PR:		kern/119123
  Tested by:	Ashish Shukla  wahjava gmail.com
  MFC after:	3 days

Modified:
  head/sys/netinet6/ip6_output.c

Modified: head/sys/netinet6/ip6_output.c
==============================================================================
--- head/sys/netinet6/ip6_output.c	Wed Oct 15 16:58:35 2008	(r183922)
+++ head/sys/netinet6/ip6_output.c	Wed Oct 15 19:24:18 2008	(r183923)
@@ -2820,7 +2820,7 @@ ip6_setpktopts(struct mbuf *control, str
 	if (control->m_next)
 		return (EINVAL);
 
-	for (; control->m_len; control->m_data += CMSG_ALIGN(cm->cmsg_len),
+	for (; control->m_len > 0; control->m_data += CMSG_ALIGN(cm->cmsg_len),
 	    control->m_len -= CMSG_ALIGN(cm->cmsg_len)) {
 		int error;
 

From owner-svn-src-head@FreeBSD.ORG  Wed Oct 15 21:25:12 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4B69E106568F;
	Wed, 15 Oct 2008 21:25:12 +0000 (UTC)
	(envelope-from n_hibma@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 37A128FC0C;
	Wed, 15 Oct 2008 21:25:12 +0000 (UTC)
	(envelope-from n_hibma@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9FLPC4m043717;
	Wed, 15 Oct 2008 21:25:12 GMT (envelope-from n_hibma@svn.freebsd.org)
Received: (from n_hibma@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9FLPC0H043714;
	Wed, 15 Oct 2008 21:25:12 GMT (envelope-from n_hibma@svn.freebsd.org)
Message-Id: <200810152125.m9FLPC0H043714@svn.freebsd.org>
From: Nick Hibma 
Date: Wed, 15 Oct 2008 21:25:12 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183925 - head/sys/dev/usb
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 15 Oct 2008 21:25:12 -0000

Author: n_hibma
Date: Wed Oct 15 21:25:11 2008
New Revision: 183925
URL: http://svn.freebsd.org/changeset/base/183925

Log:
  Rewrite the driver to better support the Huawei devices. It should now support
  the Sierra and Novatel devices, ignore all umass devices and hide the umass
  devices that represent the CD ROM devices (but not the SD card slot in the
  Huawei Mobile dongle).
  
  Note: This driver in FBSD7 seems to suffer from memory corruption when used
  with an Option GT Quad. The E220 however works flawlessly.
  
  Also add the ID for the Option GTMaxHSUPA, provided by Olivier Fromme.

Modified:
  head/sys/dev/usb/u3g.c
  head/sys/dev/usb/ubsa.c
  head/sys/dev/usb/usbdevs

Modified: head/sys/dev/usb/u3g.c
==============================================================================
--- head/sys/dev/usb/u3g.c	Wed Oct 15 20:44:00 2008	(r183924)
+++ head/sys/dev/usb/u3g.c	Wed Oct 15 21:25:11 2008	(r183925)
@@ -19,6 +19,14 @@
  * $FreeBSD$
  */
 
+/*
+ * Notes:
+ * - The detour through the tty layer is ridiculously expensive wrt buffering
+ *   due to the high speeds.
+ *   We should consider adding a simple r/w device which allows attaching of PPP
+ *   in a more efficient way.
+ */
+
 #include 
 #include 
 #include 
@@ -40,43 +48,39 @@
 
 #include "usbdevs.h"
 
+#define U3G_DEBUG	1
 #ifdef U3G_DEBUG
-#define DPRINTFN(n, x)	do { if (u3gdebug > (n)) printf x; } while (0)
-int	u3gtebug = 0;
+#define DPRINTF(x...)		do { if (u3gdebug) device_printf(self, ##x); } while (0)
+#define DPRINTFN(n, x...)	do { if (u3gdebug > (n)) device_printf(self, ##x); } while (0)
+int	u3gdebug = 1;
 #else
-#define DPRINTFN(n, x)
+#define DPRINTF(x...)		/* nop */
+#define DPRINTFN(n, x...)	/* nop */
 #endif
-#define DPRINTF(x) DPRINTFN(0, x)
 
-#define U3G_BUFSIZ		1024
+#define U3G_BUFSIZ		10240
 #define U3G_MAXPORTS		4
 #define U3G_CONFIG_INDEX	0
 
 struct u3g_softc {
-	struct ucom_softc	sc_ucom[U3G_MAXPORTS];;
+	struct ucom_softc	sc_ucom[U3G_MAXPORTS];
 	device_t		sc_dev;
 	usbd_device_handle	sc_udev;
-	u_int16_t		sc_flags;
-	u_char			sc_msr;
-	u_char			sc_lsr;
-	u_char			numports;
-
-	usbd_interface_handle	sc_intr_iface;	/* interrupt interface */
-#ifdef U3G_DEBUG
-	int			sc_intr_number;	/* interrupt number */
-	usbd_pipe_handle	sc_intr_pipe;	/* interrupt pipe */
-	u_char			*sc_intr_buf;	/* interrupt buffer */
-#endif
-	int			sc_isize;
+	u_int8_t		sc_speed;
+	u_int8_t		sc_flags;
+	u_char			sc_numports;
 };
 
+static int u3g_open(void *addr, int portno);
+static void u3g_close(void *addr, int portno);
+
 struct ucom_callback u3g_callback = {
 	NULL,
 	NULL,
 	NULL,
 	NULL,
-	NULL,
-	NULL,
+	u3g_open,
+	u3g_close,
 	NULL,
 	NULL,
 };
@@ -86,81 +90,106 @@ struct ucom_callback u3g_callback = {
  * Various supported device vendors/products.
  */
 struct u3g_dev_type_s {
-	struct usb_devno	u3g_dev;
-	u_int16_t		u3g_flags;
-#define U3GFL_NONE		0x0000
-#define U3GFL_HUAWEI_INIT	0x0001		/* Send USB command to reset iface to ucom mode */
+	struct usb_devno	devno;
+	u_int8_t		speed;
+#define U3GSP_GPRS		1
+#define U3GSP_EDGE		2
+#define U3GSP_UMTS		3
+#define U3GSP_HSDPA		4
+#define U3GSP_HSUPA		5
+#define U3GSP_HSPA		6
+
+	u_int8_t		flags;
+#define U3GFL_NONE		0x00
+#define U3GFL_HUAWEI_INIT	0x01		// Requires init (Huawei cards)
+#define U3GFL_STUB_WAIT		0x02		// Device reappears after a short delay
 };
 
 static const struct u3g_dev_type_s u3g_devs[] = {
 	/* OEM: Option */
-	{{ USB_VENDOR_OPTION, USB_PRODUCT_OPTION_GT3G },		U3GFL_NONE },
-	{{ USB_VENDOR_OPTION, USB_PRODUCT_OPTION_GT3GQUAD },		U3GFL_NONE },
-	{{ USB_VENDOR_OPTION, USB_PRODUCT_OPTION_GT3GPLUS },		U3GFL_NONE },
-	{{ USB_VENDOR_OPTION, USB_PRODUCT_OPTION_GTMAX36 },		U3GFL_NONE },
-	{{ USB_VENDOR_OPTION, USB_PRODUCT_OPTION_VODAFONEMC3G },	U3GFL_NONE },
+	{{ USB_VENDOR_OPTION, USB_PRODUCT_OPTION_GT3G },		U3GSP_UMTS,	U3GFL_NONE },
+	{{ USB_VENDOR_OPTION, USB_PRODUCT_OPTION_GT3GQUAD },		U3GSP_UMTS,	U3GFL_NONE },
+	{{ USB_VENDOR_OPTION, USB_PRODUCT_OPTION_GT3GPLUS },		U3GSP_UMTS,	U3GFL_NONE },
+	{{ USB_VENDOR_OPTION, USB_PRODUCT_OPTION_GTMAX36 },		U3GSP_HSDPA,	U3GFL_NONE },
+	{{ USB_VENDOR_OPTION, USB_PRODUCT_OPTION_GTMAXHSUPA },		U3GSP_HSDPA,	U3GFL_NONE },
+	{{ USB_VENDOR_OPTION, USB_PRODUCT_OPTION_VODAFONEMC3G },	U3GSP_UMTS,	U3GFL_NONE },
 	/* OEM: Qualcomm, Inc. */
-	{{ USB_VENDOR_QUALCOMMINC, USB_PRODUCT_QUALCOMMINC_CDMA_MSM },	U3GFL_NONE },
+	{{ USB_VENDOR_QUALCOMMINC, USB_PRODUCT_QUALCOMMINC_CDMA_MSM },	U3GSP_UMTS,	U3GFL_STUB_WAIT },	// XXX
 	/* OEM: Huawei */
-	/* Handled separately. Do not add!
-	{{ USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_MOBILE },		U3GFL_NONE },
-	{{ USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_E220 },		U3GFL_NONE },
-	 */
+	{{ USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_MOBILE },		U3GSP_HSDPA,	U3GFL_HUAWEI_INIT },
+	{{ USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_E220 },		U3GSP_HSDPA,	U3GFL_HUAWEI_INIT },
 	/* OEM: Novatel */
-	{{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_CDMA_MODEM },	U3GFL_NONE },
-	{{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_ES620 },		U3GFL_NONE },
-	{{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_MC950D },		U3GFL_NONE },
-	{{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_U720 },		U3GFL_NONE },
-	{{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_U727 },		U3GFL_NONE },
-	{{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_U740 },		U3GFL_NONE },
-	{{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_U740_2 },		U3GFL_NONE },
-	{{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_U870 },		U3GFL_NONE },
-	{{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_V620 },		U3GFL_NONE },
-	{{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_V640 },		U3GFL_NONE },
-	{{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_V720 },		U3GFL_NONE },
-	{{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_V740 },		U3GFL_NONE },
-	{{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_X950D },		U3GFL_NONE },
-	{{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_XU870 },		U3GFL_NONE },
-	{{ USB_VENDOR_DELL,    USB_PRODUCT_DELL_U740 },			U3GFL_NONE },
+	{{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_CDMA_MODEM },	U3GSP_UMTS,	U3GFL_STUB_WAIT },	// XXX
+	{{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_ES620 },		U3GSP_UMTS,	U3GFL_STUB_WAIT },	// XXX
+	{{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_MC950D },		U3GSP_HSUPA,	U3GFL_STUB_WAIT },
+	{{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_U720 },		U3GSP_UMTS,	U3GFL_STUB_WAIT },	// XXX
+	{{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_U727 },		U3GSP_UMTS,	U3GFL_STUB_WAIT },	// XXX
+	{{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_U740 },		U3GSP_HSDPA,	U3GFL_STUB_WAIT },
+	{{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_U740_2 },		U3GSP_HSDPA,	U3GFL_STUB_WAIT },
+	{{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_U870 },		U3GSP_UMTS,	U3GFL_STUB_WAIT },	// XXX
+	{{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_V620 },		U3GSP_UMTS,	U3GFL_STUB_WAIT },	// XXX
+	{{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_V640 },		U3GSP_UMTS,	U3GFL_STUB_WAIT },	// XXX
+	{{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_V720 },		U3GSP_UMTS,	U3GFL_STUB_WAIT },	// XXX
+	{{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_V740 },		U3GSP_HSDPA,	U3GFL_STUB_WAIT },
+	{{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_X950D },		U3GSP_HSUPA,	U3GFL_STUB_WAIT },
+	{{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_XU870 },		U3GSP_HSDPA,	U3GFL_STUB_WAIT },
+	{{ USB_VENDOR_DELL,    USB_PRODUCT_DELL_U740 },			U3GSP_HSDPA,	U3GFL_STUB_WAIT },
+	/* OEM: Merlin */
+	{{ USB_VENDOR_MERLIN, USB_PRODUCT_MERLIN_V620 },		U3GSP_UMTS,	U3GFL_NONE },		// XXX
+	/* OEM: Sierra Wireless: */
+	{{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AIRCARD580 },		U3GSP_UMTS,	U3GFL_NONE },		// XXX
+	{{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AIRCARD595 },		U3GSP_UMTS,	U3GFL_NONE },		// XXX
+	{{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AC595U },		U3GSP_UMTS,	U3GFL_NONE },		// XXX
+	{{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AC597E },		U3GSP_UMTS,	U3GFL_NONE },		// XXX
+	{{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_C597 },		U3GSP_UMTS,	U3GFL_NONE },		// XXX
+	{{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AC880 },		U3GSP_UMTS,	U3GFL_NONE },		// XXX
+	{{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AC880E },		U3GSP_UMTS,	U3GFL_NONE },		// XXX
+	{{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AC880U },		U3GSP_UMTS,	U3GFL_NONE },		// XXX
+	{{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AC881 },		U3GSP_UMTS,	U3GFL_NONE },		// XXX
+	{{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AC881E },		U3GSP_UMTS,	U3GFL_NONE },		// XXX
+	{{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AC881U },		U3GSP_UMTS,	U3GFL_NONE },		// XXX
+	{{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_EM5625 },		U3GSP_UMTS,	U3GFL_NONE },		// XXX
+	{{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC5720 },		U3GSP_UMTS,	U3GFL_NONE },		// XXX
+	{{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC5720_2 },		U3GSP_UMTS,	U3GFL_NONE },		// XXX
+	{{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC5725 },		U3GSP_UMTS,	U3GFL_NONE },		// XXX
+	{{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MINI5725 },		U3GSP_UMTS,	U3GFL_NONE },		// XXX
+	{{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AIRCARD875 },		U3GSP_UMTS,	U3GFL_NONE },		// XXX
+	{{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC8755 },		U3GSP_UMTS,	U3GFL_NONE },		// XXX
+	{{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC8755_2 },		U3GSP_UMTS,	U3GFL_NONE },		// XXX
+	{{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC8755_3 },		U3GSP_UMTS,	U3GFL_NONE },		// XXX
+	{{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC8765 },		U3GSP_UMTS,	U3GFL_NONE },		// XXX
+	{{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AC875U },		U3GSP_UMTS,	U3GFL_NONE },		// XXX
+	{{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC8775_2 },		U3GSP_UMTS,	U3GFL_NONE },		// XXX
+	{{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC8780 },		U3GSP_UMTS,	U3GFL_NONE },		// XXX
+	{{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC8781 },		U3GSP_UMTS,	U3GFL_NONE },		// XXX
 };
 #define u3g_lookup(v, p) ((const struct u3g_dev_type_s *)usb_lookup(u3g_devs, v, p))
 
-#ifdef U3G_DEBUG
-static void
-u3g_intr(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status)
-{
-	struct u3g_softc *sc = (struct u3g_softc *)priv;
-	device_printf(sc->sc_dev, "Interrupt callback\n");
-}
-#endif
-
 static int
 u3g_match(device_t self)
 {
 	struct usb_attach_arg *uaa = device_get_ivars(self);
-	usb_interface_descriptor_t *id;
 	const struct u3g_dev_type_s *u3g_dev_type;
 
-	if (uaa->vendor == USB_VENDOR_HUAWEI) {
-		if (uaa->iface) {
-			/* We attach to the interface instead of the device as
-			 * some devices have a built-in SD card reader on the
-			 * second interface. If the interface class of the
-			 * first interface is no longer mass storage it has
-			 * changed appearance and we should attach it.
-			 */
-			id = usbd_get_interface_descriptor(uaa->iface);
-			if (id && id->bInterfaceClass == UICLASS_VENDOR)
-				return (UMATCH_VENDOR_PRODUCT_CONF_IFACE);
-		}
+	if (!uaa->iface)
 		return UMATCH_NONE;
-	}
 
 	u3g_dev_type = u3g_lookup(uaa->vendor, uaa->product);
-	if (u3g_dev_type)
-		return UMATCH_VENDOR_PRODUCT;
+	if (!u3g_dev_type)
+		return UMATCH_NONE;
 
-	return UMATCH_NONE;
+	if (u3g_dev_type->flags&U3GFL_HUAWEI_INIT) {
+		/* If the interface class of the first interface is no longer
+		 * mass storage the card has changed to modem (see u3g_attach()
+		 * below).
+		 */
+		usb_interface_descriptor_t *id;
+		id = usbd_get_interface_descriptor(uaa->iface);
+		if (!id || id->bInterfaceClass == UICLASS_MASS)
+			return UMATCH_NONE;
+	}
+
+	return UMATCH_VENDOR_PRODUCT_CONF_IFACE;
 }
 
 static int
@@ -168,120 +197,105 @@ u3g_attach(device_t self)
 {
 	struct u3g_softc *sc = device_get_softc(self);
 	struct usb_attach_arg *uaa = device_get_ivars(self);
+	const struct u3g_dev_type_s *u3g_dev_type;
 	usbd_device_handle dev = uaa->device;
-	usbd_interface_handle iface;
 	usb_interface_descriptor_t *id;
 	usb_endpoint_descriptor_t *ed;
-	usbd_status error;
 	int i, n; 
 	usb_config_descriptor_t *cd;
-	struct ucom_softc *ucom = NULL;
 	char devnamefmt[32];
 
-	sc->sc_dev = self;
-#ifdef U3G_DEBUG
-	sc->sc_intr_number = -1;
-	sc->sc_intr_pipe = NULL;
-#endif
-	/* Move the device into the configured state. */
-	error = usbd_set_config_index(dev, U3G_CONFIG_INDEX, 1);
-	if (error) {
-		device_printf(self, "failed to set configuration: %s\n",
-			      usbd_errstr(error));
-		goto bad;
-	}
-
 	/* get the config descriptor */
 	cd = usbd_get_config_descriptor(dev);
-
 	if (cd == NULL) {
 		device_printf(self, "failed to get configuration descriptor\n");
-		goto bad;
+		return ENXIO;
 	}
 
+	sc->sc_dev = self;
 	sc->sc_udev = dev;
-	sc->numports = (cd->bNumInterface <= U3G_MAXPORTS)?cd->bNumInterface:U3G_MAXPORTS;
-	for ( i = 0; i < sc->numports; i++ ) {
-		ucom = &sc->sc_ucom[i];
-
-		ucom->sc_dev = self;
-		ucom->sc_udev = dev;
-		error = usbd_device2interface_handle(dev, i, &iface);
-		if (error) {
-			device_printf(ucom->sc_dev,
-				"failed to get interface, err=%s\n",
-			usbd_errstr(error));
-			ucom->sc_dying = 1;
-			goto bad;
+
+	u3g_dev_type = u3g_lookup(uaa->vendor, uaa->product);
+	sc->sc_flags = u3g_dev_type->flags;
+	sc->sc_speed = u3g_dev_type->speed;
+
+	sprintf(devnamefmt,"U%d.%%d", device_get_unit(self));
+	int portno = 0;
+	for (i = 0; i < uaa->nifaces && portno < U3G_MAXPORTS; i++) {
+		if (uaa->ifaces[i] == NULL)
+			continue;
+
+		id = usbd_get_interface_descriptor(uaa->ifaces[i]);
+		if (id && id->bInterfaceClass == UICLASS_MASS) {
+			/* We attach to the interface instead of the device as
+			 * some devices have a built-in SD card reader.
+			 * Claim the first umass device (cdX) as it contains
+			 * only Windows drivers anyway (CD-ROM), hiding it.
+			 */
+#ifndef U3G_DEBUG
+			if (!bootverbose)
+				if (uaa->vendor == USB_VENDOR_HUAWEI)
+					if (id->bInterfaceNumber == 2)
+						uaa->ifaces[i] = NULL;
+#endif
+			continue;
 		}
-		id = usbd_get_interface_descriptor(iface);
-		ucom->sc_iface = iface;
 
-		ucom->sc_bulkin_no = ucom->sc_bulkout_no = -1;
+		int bulkin_no = -1, bulkout_no = -1;
 		for (n = 0; n < id->bNumEndpoints; n++) {
-			ed = usbd_interface2endpoint_descriptor(iface, n);
-			if (ed == NULL) {
-				device_printf(ucom->sc_dev,
-					      "could not read endpoint descriptor\n");
-				goto bad;
-			}
+			ed = usbd_interface2endpoint_descriptor(uaa->ifaces[i], n);
+			if (ed == NULL)
+				continue;
 			if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN
 			    && UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK)
-				ucom->sc_bulkin_no = ed->bEndpointAddress;
+				bulkin_no = ed->bEndpointAddress;
 			else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT
 				 && UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK)
-				ucom->sc_bulkout_no = ed->bEndpointAddress;
-		}
-		if (ucom->sc_bulkin_no == -1 || ucom->sc_bulkout_no == -1) {
-			device_printf(ucom->sc_dev, "missing endpoint\n");
-			goto bad;
-		}
-		ucom->sc_parent = sc;
-		ucom->sc_ibufsize = U3G_BUFSIZ;
-		ucom->sc_obufsize = U3G_BUFSIZ;
-		ucom->sc_ibufsizepad = U3G_BUFSIZ;
-		ucom->sc_opkthdrlen = 0;
-
-		ucom->sc_callback = &u3g_callback;
-
-		sprintf(devnamefmt,"U%d.%%d", device_get_unit(self));
-		DPRINTF(("u3g: in=0x%x out=0x%x, devname=%s\n",
-			 ucom->sc_bulkin_no, ucom->sc_bulkout_no, devnamefmt));
+				bulkout_no = ed->bEndpointAddress;
+
+			/* If we have found a pair of bulk-in/-out endpoints
+			 * create a serial port for it. Note: We assume that
+			 * the bulk-in and bulk-out endpoints appear in pairs.
+			 */
+			if (bulkin_no != -1 && bulkout_no != -1) {
+				struct ucom_softc *ucom = &sc->sc_ucom[portno];
+
+				ucom->sc_dev = self;
+				ucom->sc_udev = dev;
+				ucom->sc_iface = uaa->ifaces[i];
+				ucom->sc_bulkin_no = bulkin_no;
+				ucom->sc_ibufsize = U3G_BUFSIZ;
+				ucom->sc_ibufsizepad = U3G_BUFSIZ;	// XXX What's this?
+				ucom->sc_bulkout_no = bulkout_no;
+				ucom->sc_obufsize = U3G_BUFSIZ;
+				ucom->sc_opkthdrlen = 0;
+
+				ucom->sc_callback = &u3g_callback;
+				ucom->sc_parent = sc;
+				ucom->sc_portno = portno;
+
+				DPRINTF("port=%d iface=%d in=0x%x out=0x%x\n",
+					 portno, i,
+					 ucom->sc_bulkin_no,
+					 ucom->sc_bulkout_no);
 #if __FreeBSD_version < 800000
-		ucom_attach_tty(ucom, TS_CALLOUT, devnamefmt, i);
+				ucom_attach_tty(ucom, TS_CALLOUT, devnamefmt, portno);
 #else
-		ucom_attach_tty(ucom, devnamefmt, i);
+				ucom_attach_tty(ucom, devnamefmt, portno);
 #endif
-	}
-#ifdef U3G_DEBUG
-	if (sc->sc_intr_number != -1 && sc->sc_intr_pipe == NULL) {
-		sc->sc_intr_buf = malloc(sc->sc_isize, M_USBDEV, M_WAITOK);
-		error = usbd_open_pipe_intr(sc->sc_intr_iface,
-					    sc->sc_intr_number,
-					    USBD_SHORT_XFER_OK,
-					    &sc->sc_intr_pipe,
-					    sc,
-					    sc->sc_intr_buf,
-					    sc->sc_isize,
-					    u3g_intr,
-					    100);
-		if (error) {
-			device_printf(self,
-				      "cannot open interrupt pipe (addr %d)\n",
-				      sc->sc_intr_number);
-			goto bad;
+
+				uaa->ifaces[i] = NULL;
+				portno++;
+				bulkin_no = bulkout_no = -1;
+			}
 		}
+
 	}
-#endif
-	device_printf(self, "configured %d serial ports (/dev/cuaU%d.X)\n",
-		      sc->numports, device_get_unit(self));
+	sc->sc_numports = portno;
 
+	device_printf(self, "configured %d serial ports (%s)\n",
+		      sc->sc_numports, devnamefmt);
 	return 0;
-
-bad:
-	DPRINTF(("u3g_attach: ATTACH ERROR\n"));
-	ucom->sc_dying = 1;
-	return ENXIO;
 }
 
 static int
@@ -291,39 +305,98 @@ u3g_detach(device_t self)
 	int rv = 0;
 	int i;
 
-	DPRINTF(("u3g_detach: sc=%p\n", sc));
-
-	for (i = 0; i < sc->numports; i++) {
-		if(sc->sc_ucom[i].sc_udev) {
-			sc->sc_ucom[i].sc_dying = 1;
-			rv = ucom_detach(&sc->sc_ucom[i]);
-			if(rv != 0) {
-				device_printf(self, "Can't deallocat port %d\n", i);
-				return rv;
-			}
+	for (i = 0; i < sc->sc_numports; i++) {
+		sc->sc_ucom[i].sc_dying = 1;
+		rv = ucom_detach(&sc->sc_ucom[i]);
+		if (rv != 0) {
+			device_printf(self, "ucom_detach(U%d.%d\n", device_get_unit(self), i);
+			return rv;
 		}
 	}
 
+	return 0;
+}
+
+static int
+u3g_open(void *addr, int portno)
+{
+#if __FreeBSD_version < 800000
+	/* Supply generous buffering for these cards to avoid disappointments
+	 * when setting the speed incorrectly. Only do this for the first port
+	 * assuming that the rest of the ports are used for diagnostics only
+	 * anyway.
+	 * Note: We abuse the fact that ucom sets the speed through
+	 * ispeed/ospeed, not through ispeedwat/ospeedwat.
+	 */
+	if (portno == 0) {
+		struct u3g_softc *sc = addr;
+		struct ucom_softc *ucom = &sc->sc_ucom[portno];
+		struct tty *tp = ucom->sc_tty;
 #ifdef U3G_DEBUG
-	if (sc->sc_intr_pipe != NULL) {
-		int err = usbd_abort_pipe(sc->sc_intr_pipe);
-		if (err)
-			device_printf(self,
-				"abort interrupt pipe failed: %s\n",
-				usbd_errstr(err));
-		err = usbd_close_pipe(sc->sc_intr_pipe);
-		if (err)
-			device_printf(self,
-				      "close interrupt pipe failed: %s\n",
-				      usbd_errstr(err));
-		free(sc->sc_intr_buf, M_USBDEV);
-		sc->sc_intr_pipe = NULL;
+		device_t self = sc->sc_dev;
+#endif
+
+		if (sc->sc_speed&U3GSP_HSPA) {
+			tp->t_ispeedwat = 7200000;
+			tp->t_ospeedwat = 384000;
+		} else if (sc->sc_speed&U3GSP_HSUPA) {
+			tp->t_ispeedwat = 1200000;
+			tp->t_ospeedwat = 384000;
+		} else if (sc->sc_speed&U3GSP_HSDPA) {
+			tp->t_ispeedwat = 1200000;
+			tp->t_ospeedwat = 384000;
+		} else if (sc->sc_speed&U3GSP_UMTS) {
+			tp->t_ispeedwat = 384000;
+			tp->t_ospeedwat = 64000;
+		} else if (sc->sc_speed&U3GSP_EDGE) {
+			tp->t_ispeedwat = 384000;
+			tp->t_ospeedwat = 64000;
+		} else {
+			tp->t_ispeedwat = 64000;
+			tp->t_ospeedwat = 64000;
+		}
+
+		/* Avoid excessive buffer sizes. On modern fast machines this is
+		 * not needed.
+		 * XXX The values here should be checked. Lower them and see
+		 * whether 'lost chars' messages appear.
+		 */
+		if (tp->t_ispeedwat > 384000)
+		    tp->t_ispeedwat = 384000;
+		if (tp->t_ospeedwat > 384000)
+		    tp->t_ospeedwat = 384000;
+
+		DPRINTF("ispeedwat = %d, ospeedwat = %d\n",
+			tp->t_ispeedwat, tp->t_ospeedwat);
+		ttsetwater(tp);
 	}
 #endif
 
 	return 0;
 }
 
+static void
+u3g_close(void *addr, int portno)
+{
+#if __FreeBSD_version < 800000
+	if (portno == 0) {	/* see u3g_open() */
+		/* Reduce the buffers allocated above again */
+		struct u3g_softc *sc = addr;
+		struct ucom_softc *ucom = &sc->sc_ucom[portno];
+		struct tty *tp = ucom->sc_tty;
+#ifdef U3G_DEBUG
+		device_t self = sc->sc_dev;
+#endif
+
+		tp->t_ispeedwat = (speed_t)-1;
+		tp->t_ospeedwat = (speed_t)-1;
+
+		DPRINTF("ispeedwat = default, ospeedwat = default\n");
+		ttsetwater(tp);
+	}
+#endif
+}	
+
 static device_method_t u3g_methods[] = {
 	/* Device interface */
 	DEVMETHOD(device_probe, u3g_match),
@@ -365,32 +438,29 @@ static int
 u3gstub_match(device_t self)
 {
 	struct usb_attach_arg *uaa = device_get_ivars(self);
-	usb_device_descriptor_t *dd = usbd_get_device_descriptor(uaa->device);
+	const struct u3g_dev_type_s *u3g_dev_type;
 	usb_interface_descriptor_t *id;
 
-	/* These are 3G modem devices (E220, Mobile, etc.) with auto-install
-	 * flash disks for Windows/MacOSX through the first interface.
+	/* This stub handles 3G modem devices (E220, Mobile, etc.) with
+	 * auto-install flash disks for Windows/MacOSX on the first interface.
+	 * After some command or some delay they change appearance to a modem.
 	 */
-	if (uaa->vendor == USB_VENDOR_HUAWEI) {
-		/* The Huawei device presents itself as a umass device with
-		 * Windows drivers on it. After installation of the driver, it
-		 * reinits into a 3G serial device.
-		 */
-		if (uaa->iface) {
-			id = usbd_get_interface_descriptor(uaa->iface);
-			if (id && id->bInterfaceNumber == 0 && id->bInterfaceClass == UICLASS_MASS) {
-				u3gstub_huawei_init(uaa->device);
-				return (UMATCH_VENDOR_PRODUCT_CONF_IFACE);
-			}
-		}
-	}
 
-	if (UGETW(dd->idVendor) == USB_VENDOR_QUALCOMMINC
-	    || UGETW(dd->idVendor) == USB_VENDOR_NOVATEL) {
-		/* Device by these vendors will automatically reappear as a
-		 * ucom device if ignored (or if sent an eject command).
+	if (!uaa->iface)
+		return UMATCH_NONE;
+
+	u3g_dev_type = u3g_lookup(uaa->vendor, uaa->product);
+	if (!u3g_dev_type)
+		return UMATCH_NONE;
+
+	if (u3g_dev_type->flags&U3GFL_HUAWEI_INIT
+	    || u3g_dev_type->flags&U3GFL_STUB_WAIT) {
+		/* We assume that if the first interface is still a mass
+		 * storage device the device has not yet changed appearance.
 		 */
-		return UMATCH_VENDOR_PRODUCT;
+		id = usbd_get_interface_descriptor(uaa->iface);
+		if (id && id->bInterfaceNumber == 0 && id->bInterfaceClass == UICLASS_MASS)
+			return UMATCH_VENDOR_PRODUCT;
 	}
 
 	return UMATCH_NONE;
@@ -399,11 +469,28 @@ u3gstub_match(device_t self)
 static int
 u3gstub_attach(device_t self)
 {
-#if 0
-	if (!bootverbose)
+	struct usb_attach_arg *uaa = device_get_ivars(self);
+	const struct u3g_dev_type_s *u3g_dev_type;
+	int i;
+#ifndef U3G_DEBUG
+	if (!bootverbose)				// hide the stub attachment
 		device_quiet(self);
 #endif
 
+	if (uaa->iface)
+		for (i = 0; i < uaa->nifaces; i++)
+			uaa->ifaces[i] = NULL;		// claim all interfaces
+
+	u3g_dev_type = u3g_lookup(uaa->vendor, uaa->product);
+	if (u3g_dev_type->flags&U3GFL_HUAWEI_INIT) {
+		/* XXX Should we delay the kick?
+		 */
+		DPRINTF("changing Huawei modem to modem mode\n");
+		u3gstub_huawei_init(uaa->device);
+	} else if (u3g_dev_type->flags&U3GFL_STUB_WAIT) {
+		/* nop  */
+	}
+
 	return 0;
 }
 

Modified: head/sys/dev/usb/ubsa.c
==============================================================================
--- head/sys/dev/usb/ubsa.c	Wed Oct 15 20:44:00 2008	(r183924)
+++ head/sys/dev/usb/ubsa.c	Wed Oct 15 21:25:11 2008	(r183925)
@@ -226,52 +226,6 @@ static const struct ubsa_product {
 	{ USB_VENDOR_GOHUBS, USB_PRODUCT_GOHUBS_GOCOM232 },
 	/* Peracom */
 	{ USB_VENDOR_PERACOM, USB_PRODUCT_PERACOM_SERIAL1 },
-	/* Merlin */
-	{ USB_VENDOR_MERLIN, USB_PRODUCT_MERLIN_V620 },
-	/* Sierra Wireless AirCard 580 */
-	{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AIRCARD580 },
-	/* Sierra Wireless AirCard 595 */
-	{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AIRCARD595 },
-	/* Sierra Wireless AirCard 595U */
-	{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AC595U },
-	/* Sierra Wireless AirCard 597E */
-	{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AC597E },
-	/* Sierra Wireless Compass 597 */
-	{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_C597 },
-	/* Sierra Wireless AirCard 880 */
-	{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AC880 },
-	/* Sierra Wireless AirCard 880E */
-	{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AC880E },
-	/* Sierra Wireless AirCard 880U */
-	{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AC880U },
-	/* Sierra Wireless AirCard 881 */
-	{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AC881 },
-	/* Sierra Wireless AirCard 881E */
-	{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AC881E },
-	/* Sierra Wireless AirCard 881U */
-	{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AC881U },
-	/* Sierra Wireless EM5625 */
-	{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_EM5625 },
-	/* Sierra Wireless MC5720 */
-	{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC5720 },
-	{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC5720_2 },
-	/* Sierra Wireless MC5725 */
-	{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC5725 },
-	{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MINI5725 },
-	/* Sierra Wireless MC8755 */
-	{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AIRCARD875 },
-	{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC8755 },
-	{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC8755_2 },
-	{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC8755_3 },
-	/* Sierra Wireless MC8765 */
-	{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC8765 },
-	/* Sierra Wireless MC8775 */
-	{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AC875U },
-	{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC8775_2 },
-	/* Sierra Wireless MC8780 */
-	{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC8780 },
-	/* Sierra Wireless MC8781 */
-	{ USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC8781 },
 	{ 0, 0 }
 };
 

Modified: head/sys/dev/usb/usbdevs
==============================================================================
--- head/sys/dev/usb/usbdevs	Wed Oct 15 20:44:00 2008	(r183924)
+++ head/sys/dev/usb/usbdevs	Wed Oct 15 21:25:11 2008	(r183925)
@@ -1872,6 +1872,7 @@ product OPTION GT3G		0x6000	GlobeTrotter
 product OPTION GT3GQUAD		0x6300	GlobeTrotter 3G QUAD datacard
 product OPTION GT3GPLUS		0x6600	GlobeTrotter 3G+ datacard
 product OPTION GTMAX36		0x6701	GlobeTrotter Max 3.6 Modem
+product OPTION GTMAXHSUPA	0x7001	GlobeTrotter HSUPA
 
 /* OQO */
 product OQO WIFI01		0x0002	model 01 WiFi interface

From owner-svn-src-head@FreeBSD.ORG  Wed Oct 15 21:47:01 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 730F810656A7;
	Wed, 15 Oct 2008 21:47:01 +0000 (UTC)
	(envelope-from n_hibma@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 6148D8FC1F;
	Wed, 15 Oct 2008 21:47:01 +0000 (UTC)
	(envelope-from n_hibma@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9FLl1bM044119;
	Wed, 15 Oct 2008 21:47:01 GMT (envelope-from n_hibma@svn.freebsd.org)
Received: (from n_hibma@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9FLl1pl044118;
	Wed, 15 Oct 2008 21:47:01 GMT (envelope-from n_hibma@svn.freebsd.org)
Message-Id: <200810152147.m9FLl1pl044118@svn.freebsd.org>
From: Nick Hibma 
Date: Wed, 15 Oct 2008 21:47:01 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183926 - head/share/man/man4
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Wed, 15 Oct 2008 21:47:01 -0000

Author: n_hibma
Date: Wed Oct 15 21:47:01 2008
New Revision: 183926
URL: http://svn.freebsd.org/changeset/base/183926

Log:
  Comment on the umass CD ROM devices in the UMTS modems.

Modified:
  head/share/man/man4/u3g.4

Modified: head/share/man/man4/u3g.4
==============================================================================
--- head/share/man/man4/u3g.4	Wed Oct 15 21:25:11 2008	(r183925)
+++ head/share/man/man4/u3g.4	Wed Oct 15 21:47:01 2008	(r183926)
@@ -73,6 +73,8 @@ Huawei E220 (E270?)
 Huawei Mobile
 .It
 Novatal MC950D
+.It
+Sierra cards
 .El
 (See /sys/dev/u3g.c for the complete list of supported cards for each vendor
 mentioned above).
@@ -80,6 +82,12 @@ mentioned above).
 The supported 3G cards provide the necessary modem port for ppp,
 pppd, or mpd connections as well as extra ports (depending on the specific
 device) to provide other functions (diagnostic port, SIM toolkit port)
+.Pp
+In some of these devices a mass storage device supported by the 
+.Xr umass 4
+driver is present which contains Windows and Mac OSX drivers. This device is
+hidden, unless the machine was booted in verbose (see
+.Xr boot 8 ).
 .Sh SEE ALSO
 .Xr tty 4 ,
 .Xr ucom 4 ,
@@ -97,5 +105,7 @@ in September 2008.
 The
 .Nm
 driver was written by
-.An Andrea Guzzo Aq aguzzo@anywi.com .
+.An Andrea Guzzo Aq aguzzo@anywi.com
+and
+.An Nick Hibma Aq n_hibma@freebsd.org .
 Hardware for testing provided by AnyWi Technologies, Leiden, NL.

From owner-svn-src-head@FreeBSD.ORG  Thu Oct 16 04:17:18 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1F7281065686;
	Thu, 16 Oct 2008 04:17:18 +0000 (UTC)
	(envelope-from davidxu@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0DF708FC0A;
	Thu, 16 Oct 2008 04:17:18 +0000 (UTC)
	(envelope-from davidxu@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9G4HHKW051249;
	Thu, 16 Oct 2008 04:17:17 GMT (envelope-from davidxu@svn.freebsd.org)
Received: (from davidxu@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9G4HHAM051248;
	Thu, 16 Oct 2008 04:17:17 GMT (envelope-from davidxu@svn.freebsd.org)
Message-Id: <200810160417.m9G4HHAM051248@svn.freebsd.org>
From: David Xu 
Date: Thu, 16 Oct 2008 04:17:17 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183929 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 16 Oct 2008 04:17:18 -0000

Author: davidxu
Date: Thu Oct 16 04:17:17 2008
New Revision: 183929
URL: http://svn.freebsd.org/changeset/base/183929

Log:
  Restore code wrongly removed in SVN revision 173004, it causes threaded
  process to be stuck in execv().
  
  Noticed by: delphij

Modified:
  head/sys/kern/kern_thread.c

Modified: head/sys/kern/kern_thread.c
==============================================================================
--- head/sys/kern/kern_thread.c	Thu Oct 16 01:46:01 2008	(r183928)
+++ head/sys/kern/kern_thread.c	Thu Oct 16 04:17:17 2008	(r183929)
@@ -572,8 +572,16 @@ thread_single(int mode)
 						    sleepq_abort(td2, EINTR);
 					break;
 				case SINGLE_BOUNDARY:
+					if (TD_IS_SUSPENDED(td2) &&
+					    !(td2->td_flags & TDF_BOUNDARY))
+						wakeup_swapper |=
+						    thread_unsuspend_one(td2);
+					if (TD_ON_SLEEPQ(td2) &&
+					    (td2->td_flags & TDF_SINTR))
+						wakeup_swapper |=
+						    sleepq_abort(td2, ERESTART);
 					break;
-				default:	
+				default:
 					if (TD_IS_SUSPENDED(td2)) {
 						thread_unlock(td2);
 						continue;

From owner-svn-src-head@FreeBSD.ORG  Thu Oct 16 12:31:03 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E34C0106568B;
	Thu, 16 Oct 2008 12:31:03 +0000 (UTC) (envelope-from zec@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D2B9E8FC1F;
	Thu, 16 Oct 2008 12:31:03 +0000 (UTC) (envelope-from zec@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9GCV3Jw061686;
	Thu, 16 Oct 2008 12:31:03 GMT (envelope-from zec@svn.freebsd.org)
Received: (from zec@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9GCV30h061685;
	Thu, 16 Oct 2008 12:31:03 GMT (envelope-from zec@svn.freebsd.org)
Message-Id: <200810161231.m9GCV30h061685@svn.freebsd.org>
From: Marko Zec 
Date: Thu, 16 Oct 2008 12:31:03 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183954 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 16 Oct 2008 12:31:04 -0000

Author: zec
Date: Thu Oct 16 12:31:03 2008
New Revision: 183954
URL: http://svn.freebsd.org/changeset/base/183954

Log:
  Remove a useless global static variable.
  
  Approved by:	bz (ad-hoc mentor)

Modified:
  head/sys/netinet/if_ether.c

Modified: head/sys/netinet/if_ether.c
==============================================================================
--- head/sys/netinet/if_ether.c	Thu Oct 16 11:02:05 2008	(r183953)
+++ head/sys/netinet/if_ether.c	Thu Oct 16 12:31:03 2008	(r183954)
@@ -98,7 +98,6 @@ struct llinfo_arp {
 };
 
 static struct	ifqueue arpintrq;
-static int	arp_allocated;
 
 static int	arp_maxtries = 5;
 static int	useloopback = 1; /* use loopback interface for local traffic */
@@ -221,7 +220,6 @@ arp_rtrequest(int req, struct rtentry *r
 			log(LOG_DEBUG, "%s: malloc failed\n", __func__);
 			break;
 		}
-		arp_allocated++;
 		/*
 		 * We are storing a route entry outside of radix tree. So,
 		 * it can be found and accessed by other means than radix

From owner-svn-src-head@FreeBSD.ORG  Thu Oct 16 12:42:57 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1BA6C1065696;
	Thu, 16 Oct 2008 12:42:57 +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 09F188FC27;
	Thu, 16 Oct 2008 12:42:57 +0000 (UTC)
	(envelope-from attilio@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9GCgu2o061910;
	Thu, 16 Oct 2008 12:42:56 GMT (envelope-from attilio@svn.freebsd.org)
Received: (from attilio@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9GCgu5w061909;
	Thu, 16 Oct 2008 12:42:56 GMT (envelope-from attilio@svn.freebsd.org)
Message-Id: <200810161242.m9GCgu5w061909@svn.freebsd.org>
From: Attilio Rao 
Date: Thu, 16 Oct 2008 12:42:56 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183955 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 16 Oct 2008 12:42:57 -0000

Author: attilio
Date: Thu Oct 16 12:42:56 2008
New Revision: 183955
URL: http://svn.freebsd.org/changeset/base/183955

Log:
  - Fix a race in witness_checkorder() where, between the PCPU_GET() and
    PCPU_PTR() curthread can migrate on another CPU and get incorrect
    results.
  - Fix a similar race into witness_warn().
  - Fix the interlock's checks bypassing by correctly using the appropriate
    children even when the lock_list chunk to be explored is not the first
    one.
  - Allow witness_warn() to work with spinlocks too.
  
  Bugs found by:	tegge
  Submitted by:	jhb, tegge
  Tested by:	Giovanni Trematerra 

Modified:
  head/sys/kern/subr_witness.c

Modified: head/sys/kern/subr_witness.c
==============================================================================
--- head/sys/kern/subr_witness.c	Thu Oct 16 12:31:03 2008	(r183954)
+++ head/sys/kern/subr_witness.c	Thu Oct 16 12:42:56 2008	(r183955)
@@ -103,6 +103,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1015,7 +1016,7 @@ void
 witness_checkorder(struct lock_object *lock, int flags, const char *file,
     int line, struct lock_object *interlock)
 {
-	struct lock_list_entry **lock_list, *lle;
+	struct lock_list_entry *lock_list, *lle;
 	struct lock_instance *lock1, *lock2, *plock;
 	struct lock_class *class;
 	struct witness *w, *w1;
@@ -1046,35 +1047,34 @@ witness_checkorder(struct lock_object *l
 		 * If this is the first lock acquired then just return as
 		 * no order checking is needed.
 		 */
-		if (td->td_sleeplocks == NULL)
+		lock_list = td->td_sleeplocks;
+		if (lock_list == NULL || lock_list->ll_count == 0)
 			return;
-		lock_list = &td->td_sleeplocks;
 	} else {
 
 		/*
 		 * If this is the first lock, just return as no order
-		 * checking is needed.  We check this in both if clauses
-		 * here as unifying the check would require us to use a
-		 * critical section to ensure we don't migrate while doing
-		 * the check.  Note that if this is not the first lock, we
-		 * are already in a critical section and are safe for the
-		 * rest of the check.
+		 * checking is needed.  Avoid problems with thread
+		 * migration pinning the thread while checking if
+		 * spinlocks are held.  If at least one spinlock is held
+		 * the thread is in a safe path and it is allowed to
+		 * unpin it.
 		 */
-		if (PCPU_GET(spinlocks) == NULL)
+		sched_pin();
+		lock_list = PCPU_GET(spinlocks);
+		if (lock_list == NULL || lock_list->ll_count == 0) {
+			sched_unpin();
 			return;
-		lock_list = PCPU_PTR(spinlocks);
+		}
+		sched_unpin();
 	}
 
-	/* Empty list? */
-	if ((*lock_list)->ll_count == 0)
-		return;
-
 	/*
 	 * Check to see if we are recursing on a lock we already own.  If
 	 * so, make sure that we don't mismatch exclusive and shared lock
 	 * acquires.
 	 */
-	lock1 = find_instance(*lock_list, lock);
+	lock1 = find_instance(lock_list, lock);
 	if (lock1 != NULL) {
 		if ((lock1->li_flags & LI_EXCLUSIVE) != 0 &&
 		    (flags & LOP_EXCLUSIVE) == 0) {
@@ -1098,17 +1098,22 @@ witness_checkorder(struct lock_object *l
 	/*
 	 * Find the previously acquired lock, but ignore interlocks.
 	 */
-	plock = &(*lock_list)->ll_children[(*lock_list)->ll_count - 1];
+	plock = &lock_list->ll_children[lock_list->ll_count - 1];
 	if (interlock != NULL && plock->li_lock == interlock) {
-		if ((*lock_list)->ll_count == 1) {
+		if (lock_list->ll_count > 1)
+			plock =
+			    &lock_list->ll_children[lock_list->ll_count - 2];
+		else {
+			lle = lock_list->ll_next;
 
 			/*
 			 * The interlock is the only lock we hold, so
-			 * nothing to do.
+			 * simply return.
 			 */
-			return;
+			if (lle == NULL)
+				return;
+			plock = &lle->ll_children[lle->ll_count - 1];
 		}
-		plock = &(*lock_list)->ll_children[(*lock_list)->ll_count - 2];
 	}
 	
 	/*
@@ -1154,7 +1159,7 @@ witness_checkorder(struct lock_object *l
 	if (isitmychild(w1, w))
 		goto out;
 
-	for (j = 0, lle = *lock_list; lle != NULL; lle = lle->ll_next) {
+	for (j = 0, lle = lock_list; lle != NULL; lle = lle->ll_next) {
 		for (i = lle->ll_count - 1; i >= 0; i--, j++) {
 
 			MPASS(j < WITNESS_COUNT);
@@ -1582,7 +1587,7 @@ witness_thread_exit(struct thread *td)
 int
 witness_warn(int flags, struct lock_object *lock, const char *fmt, ...)
 {
-	struct lock_list_entry **lock_list, *lle;
+	struct lock_list_entry *lock_list, *lle;
 	struct lock_instance *lock1;
 	struct thread *td;
 	va_list ap;
@@ -1615,17 +1620,33 @@ witness_warn(int flags, struct lock_obje
 			n++;
 			witness_list_lock(lock1);
 		}
-	if (PCPU_GET(spinlocks) != NULL) {
-		lock_list = PCPU_PTR(spinlocks);
+
+	/*
+	 * Pin the thread in order to avoid problems with thread migration.
+	 * Once that all verifies are passed about spinlocks ownership,
+	 * the thread is in a safe path and it can be unpinned.
+	 */
+	sched_pin();
+	lock_list = PCPU_GET(spinlocks);
+	if (lock_list != NULL) {
 
 		/* Empty list? */
-		if ((*lock_list)->ll_count == 0)
+		if (lock_list->ll_count == 0) {
+			sched_unpin();
 			return (n);
+		}
+		sched_unpin();
 
 		/*
-		 * Since we already hold a spinlock preemption is
-		 * already blocked.
+		 * We should only have one spinlock and as long as
+		 * the flags cannot match for this locks class,
+		 * check if the first spinlock is the one curthread
+		 * should hold.
 		 */
+		lock1 = &lock_list->ll_children[lock_list->ll_count - 1];
+		if (lock1->li_lock == lock)
+			return (n);
+
 		if (n == 0) {
 			va_start(ap, fmt);
 			vprintf(fmt, ap);
@@ -1635,8 +1656,9 @@ witness_warn(int flags, struct lock_obje
 				printf(" non-sleepable");
 			printf(" locks held:\n");
 		}
-		n += witness_list_locks(PCPU_PTR(spinlocks));
-	}
+		n += witness_list_locks(&lock_list);
+	} else
+		sched_unpin();
 	if (flags & WARN_PANIC && n)
 		panic("%s", __func__);
 	else

From owner-svn-src-head@FreeBSD.ORG  Thu Oct 16 18:09:27 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DE4961065688;
	Thu, 16 Oct 2008 18:09:27 +0000 (UTC)
	(envelope-from obrien@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C7AA38FC1C;
	Thu, 16 Oct 2008 18:09:27 +0000 (UTC)
	(envelope-from obrien@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9GI9RbE067409;
	Thu, 16 Oct 2008 18:09:27 GMT (envelope-from obrien@svn.freebsd.org)
Received: (from obrien@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9GI9R2D067407;
	Thu, 16 Oct 2008 18:09:27 GMT (envelope-from obrien@svn.freebsd.org)
Message-Id: <200810161809.m9GI9R2D067407@svn.freebsd.org>
From: "David E. O'Brien" 
Date: Thu, 16 Oct 2008 18:09:27 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183957 - in head/gnu/usr.bin/gdb/arch: amd64 i386
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 16 Oct 2008 18:09:28 -0000

Author: obrien
Date: Thu Oct 16 18:09:27 2008
New Revision: 183957
URL: http://svn.freebsd.org/changeset/base/183957

Log:
  Document what the sed trick is for.
  Remove an embedded , and use same style for both files.

Modified:
  head/gnu/usr.bin/gdb/arch/amd64/Makefile
  head/gnu/usr.bin/gdb/arch/i386/Makefile

Modified: head/gnu/usr.bin/gdb/arch/amd64/Makefile
==============================================================================
--- head/gnu/usr.bin/gdb/arch/amd64/Makefile	Thu Oct 16 17:11:06 2008	(r183956)
+++ head/gnu/usr.bin/gdb/arch/amd64/Makefile	Thu Oct 16 18:09:27 2008	(r183957)
@@ -7,7 +7,7 @@ LIBSRCS+= amd64-nat.c amd64bsd-nat.c amd
 .endif
 LIBSRCS+= solib.c solib-svr4.c
 LIBSRCS+= amd64-tdep.c amd64fbsd-tdep.c i386-tdep.c i386bsd-tdep.c \
-	i386fbsd-tdep-fixed.c	i387-tdep.c
+	i386fbsd-tdep-fixed.c i387-tdep.c
 
 nm.h:
 	echo '#include "i386/nm-fbsd64.h"' > ${.TARGET}
@@ -18,7 +18,7 @@ tm.h:
 xm.h:
 	echo '#include "i386/xm-i386.h"' > ${.TARGET}
 
+# Fix source static/extern mismatch nits that GCC 4.2 warns about.
+CLEANFILES+= i386fbsd-tdep-fixed.c
 i386fbsd-tdep-fixed.c: i386fbsd-tdep.c
 	sed -e '48s/^static //' ${.ALLSRC} > ${.TARGET}
-
-CLEANFILES+= i386fbsd-tdep-fixed.c

Modified: head/gnu/usr.bin/gdb/arch/i386/Makefile
==============================================================================
--- head/gnu/usr.bin/gdb/arch/i386/Makefile	Thu Oct 16 17:11:06 2008	(r183956)
+++ head/gnu/usr.bin/gdb/arch/i386/Makefile	Thu Oct 16 18:09:27 2008	(r183957)
@@ -17,6 +17,7 @@ tm.h:
 xm.h:
 	echo '#include "i386/xm-i386.h"' > ${.TARGET}
 
+# Fix source static/extern mismatch nits that GCC 4.2 warns about.
+CLEANFILES += i386fbsd-tdep-fixed.c
 i386fbsd-tdep-fixed.c: i386fbsd-tdep.c
 	sed -e '48s/^static\ //' ${.ALLSRC} > ${.TARGET}
-CLEANFILES += i386fbsd-tdep-fixed.c

From owner-svn-src-head@FreeBSD.ORG  Thu Oct 16 19:06:25 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2896110656AA;
	Thu, 16 Oct 2008 19:06:25 +0000 (UTC) (envelope-from raj@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 166288FC13;
	Thu, 16 Oct 2008 19:06:25 +0000 (UTC) (envelope-from raj@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9GJ6OGM068434;
	Thu, 16 Oct 2008 19:06:24 GMT (envelope-from raj@svn.freebsd.org)
Received: (from raj@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9GJ6OXG068433;
	Thu, 16 Oct 2008 19:06:24 GMT (envelope-from raj@svn.freebsd.org)
Message-Id: <200810161906.m9GJ6OXG068433@svn.freebsd.org>
From: Rafal Jaworowski 
Date: Thu, 16 Oct 2008 19:06:24 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183958 - head/sys/arm/arm
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 16 Oct 2008 19:06:25 -0000

Author: raj
Date: Thu Oct 16 19:06:24 2008
New Revision: 183958
URL: http://svn.freebsd.org/changeset/base/183958

Log:
  Eliminate flushing of L2 cache in ARM context switch routines.
  
  With VIPT L2 cache such syncing not only is redundant, but also a performance
  penalty.
  
  Pointed out by:	cognet

Modified:
  head/sys/arm/arm/swtch.S

Modified: head/sys/arm/arm/swtch.S
==============================================================================
--- head/sys/arm/arm/swtch.S	Thu Oct 16 18:09:27 2008	(r183957)
+++ head/sys/arm/arm/swtch.S	Thu Oct 16 19:06:24 2008	(r183958)
@@ -143,8 +143,6 @@ ENTRY(cpu_throw)
 	ldr	r9, .Lcpufuncs
 	mov	lr, pc
 	ldr	pc, [r9, #CF_IDCACHE_WBINV_ALL]
-	mov	lr, pc
-	ldr	pc, [r9, #CF_L2CACHE_WBINV_ALL]
 	ldr	r0, [r7, #(PCB_PL1VEC)]
 	ldr	r1, [r7, #(PCB_DACR)]
 	/*
@@ -174,8 +172,6 @@ ENTRY(cpu_throw)
 	movne	r1, #4
 	movne	lr, pc
 	ldrne	pc, [r9, #CF_DCACHE_WB_RANGE]
-	movne	lr, pc
-	ldrne	pc, [r9, #CF_L2CACHE_WB_RANGE]
 #endif /* PMAP_INCLUDE_PTE_SYNC */
 
 	/*
@@ -332,8 +328,6 @@ ENTRY(cpu_switch)
 	ldr	r1, .Lcpufuncs
 	mov	lr, pc
 	ldr	pc, [r1, #CF_IDCACHE_WBINV_ALL]
-	mov	lr, pc
-	ldr	pc, [r1, #CF_L2CACHE_WBINV_ALL]
 .Lcs_cache_purge_skipped:
 	/* rem: r6 = lock */
 	/* rem: r9 = new PCB */
@@ -366,8 +360,6 @@ ENTRY(cpu_switch)
 	mov	r1, #4
 	mov	lr, pc
 	ldr	pc, [r2, #CF_DCACHE_WB_RANGE]
-	mov	lr, pc
-	ldr	pc, [r2, #CF_L2CACHE_WB_RANGE]
 
 .Lcs_same_vector:
 #endif /* PMAP_INCLUDE_PTE_SYNC */

From owner-svn-src-head@FreeBSD.ORG  Thu Oct 16 19:07:55 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 91A5E106568E;
	Thu, 16 Oct 2008 19:07:55 +0000 (UTC)
	(envelope-from raj@semihalf.com)
Received: from semihalf.com (semihalf.com [206.130.101.55])
	by mx1.freebsd.org (Postfix) with ESMTP id 36F4B8FC14;
	Thu, 16 Oct 2008 19:07:55 +0000 (UTC)
	(envelope-from raj@semihalf.com)
Received: from mail.semihalf.com (mail.semihalf.com [83.15.139.206])
	by semihalf.com (8.13.1/8.13.1) with ESMTP id m9GJ7rT5005432;
	Thu, 16 Oct 2008 13:07:54 -0600
Message-ID: <48F79107.1050301@semihalf.com>
Date: Thu, 16 Oct 2008 21:07:51 +0200
From: Rafal Jaworowski 
Organization: Semihalf
MIME-Version: 1.0
To: Attilio Rao 
References: <200810140705.m9E75K3x098307@svn.freebsd.org>
	<3bbf2fe10810141322o5ee27a2eka8a3a902ced6fc97@mail.gmail.com>
In-Reply-To: <3bbf2fe10810141322o5ee27a2eka8a3a902ced6fc97@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r183866 - head/sys/dev/usb
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 16 Oct 2008 19:07:55 -0000

Attilio Rao wrote:
[...]

>>
>>  Added: head/sys/dev/usb/ehci_mbus.c

[...]

> Why this includes lockmgr?
> I don't think it needs.

It seems required by ehci_softc: struct lock (sc_doorbell_lock) field.

Rafal

From owner-svn-src-head@FreeBSD.ORG  Thu Oct 16 20:39:03 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 49E001065687;
	Thu, 16 Oct 2008 20:39:03 +0000 (UTC) (envelope-from phk@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 219648FC1C;
	Thu, 16 Oct 2008 20:39:03 +0000 (UTC) (envelope-from phk@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9GKd34R070053;
	Thu, 16 Oct 2008 20:39:03 GMT (envelope-from phk@svn.freebsd.org)
Received: (from phk@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9GKd21b070051;
	Thu, 16 Oct 2008 20:39:02 GMT (envelope-from phk@svn.freebsd.org)
Message-Id: <200810162039.m9GKd21b070051@svn.freebsd.org>
From: Poul-Henning Kamp 
Date: Thu, 16 Oct 2008 20:39:02 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183960 - head/usr.bin/ministat
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 16 Oct 2008 20:39:03 -0000

Author: phk
Date: Thu Oct 16 20:39:02 2008
New Revision: 183960
URL: http://svn.freebsd.org/changeset/base/183960

Log:
  Make ministat(1) vastly faster on huge datasets.

Modified:
  head/usr.bin/ministat/Makefile
  head/usr.bin/ministat/ministat.c

Modified: head/usr.bin/ministat/Makefile
==============================================================================
--- head/usr.bin/ministat/Makefile	Thu Oct 16 20:33:03 2008	(r183959)
+++ head/usr.bin/ministat/Makefile	Thu Oct 16 20:39:02 2008	(r183960)
@@ -8,7 +8,7 @@ LDADD=	-lm
 test:	${PROG}
 	./${PROG} < ${.CURDIR}/chameleon 
 	./${PROG} ${.CURDIR}/chameleon 
-	./${PROG} ${.CURDIR}/chameleon ${.CURDIR}/iguana
-	./${PROG} -c 80 ${.CURDIR}/chameleon ${.CURDIR}/iguana
+	./${PROG} ${.CURDIR}/iguana ${.CURDIR}/chameleon
+	./${PROG} -c 80 ${.CURDIR}/iguana ${.CURDIR}/chameleon
 	./${PROG} -s -c 80 ${.CURDIR}/chameleon ${.CURDIR}/iguana
 	./${PROG} -s -c 80 ${.CURDIR}/chameleon ${.CURDIR}/iguana ${.CURDIR}/iguana

Modified: head/usr.bin/ministat/ministat.c
==============================================================================
--- head/usr.bin/ministat/ministat.c	Thu Oct 16 20:33:03 2008	(r183959)
+++ head/usr.bin/ministat/ministat.c	Thu Oct 16 20:39:02 2008	(r183960)
@@ -131,11 +131,10 @@ double student [NSTUDENT + 1][NCONF] = {
 #define	MAX_DS	8
 static char symbol[MAX_DS] = { ' ', 'x', '+', '*', '%', '#', '@', 'O' };
 
-TAILQ_HEAD(pointlist, point);
-
 struct dataset {
 	char *name;
-	struct pointlist list;
+	double	*points;
+	unsigned lpoints;
 	double sy, syy;
 	int n;
 };
@@ -146,51 +145,39 @@ NewSet(void)
 	struct dataset *ds;
 
 	ds = calloc(1, sizeof *ds);
-	TAILQ_INIT(&ds->list);
+	ds->lpoints = 100000;
+	ds->points = calloc(sizeof *ds->points, ds->lpoints);
 	return(ds);
 }
 
-struct point {
-	TAILQ_ENTRY(point)	list;
-	double			val;
-};
-
 static void
 AddPoint(struct dataset *ds, double a)
 {
-	struct point *pp, *pp2;
+	double *dp;
 
-	pp = calloc(1, sizeof *pp);
-	pp->val = a;
-
-	ds->n++;
+	if (ds->n >= ds->lpoints) {
+		dp = ds->points;
+		ds->lpoints *= 4;
+		ds->points = calloc(sizeof *ds->points, ds->lpoints);
+		memcpy(ds->points, dp, sizeof *dp * ds->n);
+	}
+	ds->points[ds->n++] = a;
 	ds->sy += a;
 	ds->syy += a * a;
-	if (TAILQ_EMPTY(&ds->list)) {
-		TAILQ_INSERT_HEAD(&ds->list, pp, list);
-		return;
-	}
-	TAILQ_FOREACH(pp2, &ds->list, list) {
-		if (pp->val < pp2->val) {
-			TAILQ_INSERT_BEFORE(pp2, pp, list);
-			return;
-		}
-	}
-	TAILQ_INSERT_TAIL(&ds->list, pp, list);
 }
 
 static double
 Min(struct dataset *ds)
 {
 
-	return (TAILQ_FIRST(&ds->list)->val);
+	return (ds->points[0]);
 }
 
 static double
 Max(struct dataset *ds)
 {
 
-	return(TAILQ_LAST(&ds->list, pointlist)->val);
+	return (ds->points[ds->n -1]);
 }
 
 static double
@@ -206,23 +193,7 @@ Median(struct dataset *ds)
 	int even, i;
 	struct point *p1, *p2;
 
-	if ((ds->n % 2) == 1) {
-		i = (ds->n / 2) + 1;
-		even = 0;
-	} else {
-		i = ds->n / 2;
-		even = 1;
-	}
-	TAILQ_FOREACH(p1, &ds->list, list) {
-		--i;
-		if (i == 0)
-			break;
-	}
-	if (even) {
-		p2 = TAILQ_NEXT(p1, list);
-		return ((p2->val + p1->val) / 2);
-	}
-	return (p1->val);
+	return (ds->points[ds->n / 2]);
 }
 
 static double
@@ -346,7 +317,7 @@ PlotSet(struct dataset *ds, int val)
 {
 	struct plot *pl;
 	struct point *pp;
-	int i, j, m, x;
+	int i, j, m, x, n;
 	int bar;
 
 	pl = &plot;
@@ -370,8 +341,8 @@ PlotSet(struct dataset *ds, int val)
 	m = 1;
 	i = -1;
 	j = 0;
-	TAILQ_FOREACH(pp, &ds->list, list) {
-		x = (pp->val - pl->x0) / pl->dx;
+	for (n = 0; n < ds->n; n++) {
+		x = (ds->points[n] - pl->x0) / pl->dx;
 		if (x == i) {
 			j++;
 			if (j > m)
@@ -389,8 +360,8 @@ PlotSet(struct dataset *ds, int val)
 	}
 	pl->height = m;
 	i = -1;
-	TAILQ_FOREACH(pp, &ds->list, list) {
-		x = (pp->val - pl->x0) / pl->dx;
+	for (n = 0; n < ds->n; n++) {
+		x = (ds->points[n] - pl->x0) / pl->dx;
 		if (x == i) {
 			j++;
 		} else {
@@ -463,6 +434,19 @@ DumpPlot(void)
 	putchar('\n');
 }
 
+static int
+dbl_cmp(const void *a, const void *b)
+{
+	const double *aa = a;
+	const double *bb = b;
+
+	if (*aa < *bb)
+		return (-1);
+	else if (*aa > *bb)
+		return (1);
+	else
+		return (0);
+}
 
 static struct dataset *
 ReadSet(const char *n, int column, const char *delim)
@@ -515,6 +499,7 @@ ReadSet(const char *n, int column, const
 		    "Dataset %s must contain at least 3 data points\n", n);
 		exit (2);
 	}
+	qsort(s->points, s->n, sizeof *s->points, dbl_cmp);
 	return (s);
 }
 

From owner-svn-src-head@FreeBSD.ORG  Thu Oct 16 20:50:04 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CD444106568E
	for ; Thu, 16 Oct 2008 20:50:04 +0000 (UTC)
	(envelope-from max@love2party.net)
Received: from moutng.kundenserver.de (moutng.kundenserver.de
	[212.227.126.186])
	by mx1.freebsd.org (Postfix) with ESMTP id 5ACEE8FC18
	for ; Thu, 16 Oct 2008 20:50:04 +0000 (UTC)
	(envelope-from max@love2party.net)
Received: from vampire.homelinux.org (dslb-088-066-000-033.pools.arcor-ip.net
	[88.66.0.33])
	by mrelayeu.kundenserver.de (node=mrelayeu6) with ESMTP (Nemesis)
	id 0ML29c-1KqZnG3Fc6-0007yX; Thu, 16 Oct 2008 22:50:03 +0200
Received: (qmail 36290 invoked from network); 16 Oct 2008 20:50:02 -0000
Received: from fbsd8.laiers.local (192.168.4.151)
	by mx.laiers.local with SMTP; 16 Oct 2008 20:50:02 -0000
From: Max Laier 
Organization: FreeBSD
To: "Poul-Henning Kamp" 
Date: Thu, 16 Oct 2008 22:50:00 +0200
User-Agent: KMail/1.10.1 (FreeBSD/8.0-CURRENT; KDE/4.1.1; i386; ; )
References: <200810162039.m9GKd21b070051@svn.freebsd.org>
In-Reply-To: <200810162039.m9GKd21b070051@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: text/plain;
  charset="utf-8"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-Id: <200810162250.01303.max@love2party.net>
X-Provags-ID: V01U2FsdGVkX1+FaXlFX3YVepQYoxRqggSWefyIDPtGMrOoAQI
	xg13H1bZOid/Gvy4vjM5GMuqjmT/CSuMq4c6xH1tuWJTgyW0aa
	EK/hWp9YmhEDqeQ8xUiGg==
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r183960 - head/usr.bin/ministat
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 16 Oct 2008 20:50:04 -0000

On Thursday 16 October 2008 22:39:02 Poul-Henning Kamp wrote:
> Author: phk
> Date: Thu Oct 16 20:39:02 2008
> New Revision: 183960
> URL: http://svn.freebsd.org/changeset/base/183960
>
> Log:
>   Make ministat(1) vastly faster on huge datasets.
>
> Modified:
>   head/usr.bin/ministat/Makefile
>   head/usr.bin/ministat/ministat.c
...
>  static void
>  AddPoint(struct dataset *ds, double a)
>  {
> -	struct point *pp, *pp2;
> +	double *dp;
>
> -	pp = calloc(1, sizeof *pp);
> -	pp->val = a;
> -
> -	ds->n++;
> +	if (ds->n >= ds->lpoints) {
> +		dp = ds->points;
> +		ds->lpoints *= 4;
> +		ds->points = calloc(sizeof *ds->points, ds->lpoints);
> +		memcpy(ds->points, dp, sizeof *dp * ds->n);

+ free(dp);

???

> +	}
> +	ds->points[ds->n++] = a;
>  	ds->sy += a;
>  	ds->syy += a * a;
> -	if (TAILQ_EMPTY(&ds->list)) {
> -		TAILQ_INSERT_HEAD(&ds->list, pp, list);
> -		return;
> -	}
> -	TAILQ_FOREACH(pp2, &ds->list, list) {
> -		if (pp->val < pp2->val) {
> -			TAILQ_INSERT_BEFORE(pp2, pp, list);
> -			return;
> -		}
> -	}
> -	TAILQ_INSERT_TAIL(&ds->list, pp, list);
>  }

-- 
/"\  Best regards,                      | mlaier@freebsd.org
\ /  Max Laier                          | ICQ #67774661
 X   http://pf4freebsd.love2party.net/  | mlaier@EFnet
/ \  ASCII Ribbon Campaign              | Against HTML Mail and News

From owner-svn-src-head@FreeBSD.ORG  Thu Oct 16 20:56:11 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 649511065686;
	Thu, 16 Oct 2008 20:56:11 +0000 (UTC) (envelope-from phk@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 520498FC35;
	Thu, 16 Oct 2008 20:56:10 +0000 (UTC) (envelope-from phk@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9GKu9o2070369;
	Thu, 16 Oct 2008 20:56:09 GMT (envelope-from phk@svn.freebsd.org)
Received: (from phk@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9GKu91q070368;
	Thu, 16 Oct 2008 20:56:09 GMT (envelope-from phk@svn.freebsd.org)
Message-Id: <200810162056.m9GKu91q070368@svn.freebsd.org>
From: Poul-Henning Kamp 
Date: Thu, 16 Oct 2008 20:56:09 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183961 - head/usr.bin/ministat
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 16 Oct 2008 20:56:11 -0000

Author: phk
Date: Thu Oct 16 20:56:09 2008
New Revision: 183961
URL: http://svn.freebsd.org/changeset/base/183961

Log:
  Free old arrays if we increase them.
  
  Pointed out by:	mlaier

Modified:
  head/usr.bin/ministat/ministat.c

Modified: head/usr.bin/ministat/ministat.c
==============================================================================
--- head/usr.bin/ministat/ministat.c	Thu Oct 16 20:39:02 2008	(r183960)
+++ head/usr.bin/ministat/ministat.c	Thu Oct 16 20:56:09 2008	(r183961)
@@ -160,6 +160,7 @@ AddPoint(struct dataset *ds, double a)
 		ds->lpoints *= 4;
 		ds->points = calloc(sizeof *ds->points, ds->lpoints);
 		memcpy(ds->points, dp, sizeof *dp * ds->n);
+		free(dp);
 	}
 	ds->points[ds->n++] = a;
 	ds->sy += a;

From owner-svn-src-head@FreeBSD.ORG  Thu Oct 16 21:10:25 2008
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B4EE61065687;
	Thu, 16 Oct 2008 21:10:25 +0000 (UTC) (envelope-from imp@bsdimp.com)
Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85])
	by mx1.freebsd.org (Postfix) with ESMTP id 674C88FC0A;
	Thu, 16 Oct 2008 21:10:25 +0000 (UTC) (envelope-from imp@bsdimp.com)
Received: from localhost (localhost [127.0.0.1])
	by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id m9GL9AMI017946;
	Thu, 16 Oct 2008 15:09:10 -0600 (MDT) (envelope-from imp@bsdimp.com)
Date: Thu, 16 Oct 2008 15:10:12 -0600 (MDT)
Message-Id: <20081016.151012.1933498518.imp@bsdimp.com>
To: scottl@samsco.org
From: "M. Warner Losh" 
In-Reply-To: <48F5053D.7070705@samsco.org>
References: <200810142028.m9EKShoL015514@svn.freebsd.org>
	<48F5053D.7070705@samsco.org>
X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Cc: svn-src-head@FreeBSD.org, marius@FreeBSD.org, src-committers@FreeBSD.org,
	svn-src-all@FreeBSD.org
Subject: Re: svn commit: r183896 - head/sys/dev/bge
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 16 Oct 2008 21:10:25 -0000

In message: <48F5053D.7070705@samsco.org>
            Scott Long  writes:
: Marius Strobl wrote:
: > Author: marius
: > Date: Tue Oct 14 20:28:42 2008
: > New Revision: 183896
: > URL: http://svn.freebsd.org/changeset/base/183896
: > 
: > Log:
: >   Use bus_{read,write}_4(9) instead of bus_space_{read,write}_4(9)
: >   in order to get rid of the bus space handle and tag in the softc.
: >   
: 
: Has anyone looked at the generated code from this interface switch and
: compared it what was getting generated previously?  Way back when,
: including  made bus_space_read|write_4() compile
: into a direct memory access on machines that supported it.  The dubious
: removal of bus_memio.h and bus_pio.h took away that benefit, and I'm
: afraid that it's only getting worse now.  Bus writes to card memory are
: still very important to high-performance devices and shouldn't be
: pessimized in the name of simpler-looking C code.

I've looked a little.  With changes similar to this change, the
generated code does look better because there's less stack traffic,
but it still isn't a direct write to memory without a function call...

Warner

From owner-svn-src-head@FreeBSD.ORG  Thu Oct 16 21:42:37 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4F3C9106569E
	for ; Thu, 16 Oct 2008 21:42:37 +0000 (UTC)
	(envelope-from asmrookie@gmail.com)
Received: from gv-out-0910.google.com (gv-out-0910.google.com [216.239.58.184])
	by mx1.freebsd.org (Postfix) with ESMTP id D286E8FC1D
	for ; Thu, 16 Oct 2008 21:42:36 +0000 (UTC)
	(envelope-from asmrookie@gmail.com)
Received: by gv-out-0910.google.com with SMTP id n8so129244gve.39
	for ; Thu, 16 Oct 2008 14:42:35 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:received:received:message-id:date:from:sender
	:to:subject:cc:in-reply-to:mime-version:content-type
	:content-transfer-encoding:content-disposition:references
	:x-google-sender-auth;
	bh=YZMn9dn3j+qKs8O37+9VuJKt6Xpa3adydDpe0wCll0I=;
	b=FrRcaumNM2aCIeSkWv5GckpmqznjopVHNZ+rTO5SScGLVSGki1yOOjmKjoudnXAWSo
	Oh4rRbyJAgOiiMEdo7ZamtO9HdpPhPI8n1uc0iul/o/O/zrKElA7l479FvOFScrPns/y
	pSid0CPtXRSBlCE+SAlixqtoNL1xRUdLCinfo=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version
	:content-type:content-transfer-encoding:content-disposition
	:references:x-google-sender-auth;
	b=GdP7HsJT7kn5xb2oG1F2mH//Dsq56XPnJXouSKF1rVgLbC+2XGMEpqiuBRj4ppOVQD
	Ez+epSFVxdjXKo8gDUSk8BJPd02o9e+jA22i63nqpbyEqtVMAKBFezLfbhJQBvSnw1oP
	JiWHqT+qkeZ9EHusHW881zzsvhQEGkcs5JWLA=
Received: by 10.103.221.5 with SMTP id y5mr1760348muq.34.1224193355229;
	Thu, 16 Oct 2008 14:42:35 -0700 (PDT)
Received: by 10.103.239.14 with HTTP; Thu, 16 Oct 2008 14:42:34 -0700 (PDT)
Message-ID: <3bbf2fe10810161442h3be5dc5al1713aaa173636658@mail.gmail.com>
Date: Thu, 16 Oct 2008 23:42:34 +0200
From: "Attilio Rao" 
Sender: asmrookie@gmail.com
To: "Rafal Jaworowski" 
In-Reply-To: <48F79107.1050301@semihalf.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
References: <200810140705.m9E75K3x098307@svn.freebsd.org>
	<3bbf2fe10810141322o5ee27a2eka8a3a902ced6fc97@mail.gmail.com>
	<48F79107.1050301@semihalf.com>
X-Google-Sender-Auth: 61cc3ecb3d8c30d8
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r183866 - head/sys/dev/usb
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Thu, 16 Oct 2008 21:42:37 -0000

2008/10/16, Rafal Jaworowski :
> Attilio Rao wrote:
>  [...]
>
>
>  >>
>  >>  Added: head/sys/dev/usb/ehci_mbus.c
>
>
> [...]
>
>
>  > Why this includes lockmgr?
>  > I don't think it needs.
>
>
> It seems required by ehci_softc: struct lock (sc_doorbell_lock) field.

Ah gah.
IIRC, it was totally unuseful to use a lockmgr there.

I will wait for Hans' work to go in before to try to fix that issue.

Thanks,
Attilio


-- 
Peace can only be achieved by understanding - A. Einstein

From owner-svn-src-head@FreeBSD.ORG  Fri Oct 17 01:25:45 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CA755106568A;
	Fri, 17 Oct 2008 01:25:45 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B8D2A8FC08;
	Fri, 17 Oct 2008 01:25:45 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9H1Pjno074924;
	Fri, 17 Oct 2008 01:25:45 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9H1PjE3074923;
	Fri, 17 Oct 2008 01:25:45 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <200810170125.m9H1PjE3074923@svn.freebsd.org>
From: Kip Macy 
Date: Fri, 17 Oct 2008 01:25:45 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183963 - head/sys/kern
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 17 Oct 2008 01:25:45 -0000

Author: kmacy
Date: Fri Oct 17 01:25:45 2008
New Revision: 183963
URL: http://svn.freebsd.org/changeset/base/183963

Log:
  make sure that SO_NO_DDP and SO_NO_OFFLOAD get passed in correctly
  
  PR:		127360
  MFC after:	3 days

Modified:
  head/sys/kern/uipc_socket.c

Modified: head/sys/kern/uipc_socket.c
==============================================================================
--- head/sys/kern/uipc_socket.c	Thu Oct 16 22:45:07 2008	(r183962)
+++ head/sys/kern/uipc_socket.c	Fri Oct 17 01:25:45 2008	(r183963)
@@ -2194,6 +2194,8 @@ sosetopt(struct socket *so, struct socko
 		case SO_TIMESTAMP:
 		case SO_BINTIME:
 		case SO_NOSIGPIPE:
+		case SO_NO_DDP:
+		case SO_NO_OFFLOAD:
 			error = sooptcopyin(sopt, &optval, sizeof optval,
 					    sizeof optval);
 			if (error)

From owner-svn-src-head@FreeBSD.ORG  Fri Oct 17 05:26:51 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EEFC5106569E;
	Fri, 17 Oct 2008 05:26:51 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id DE4428FC1D;
	Fri, 17 Oct 2008 05:26:51 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9H5QpMZ079415;
	Fri, 17 Oct 2008 05:26:51 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9H5QpbL079414;
	Fri, 17 Oct 2008 05:26:51 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200810170526.m9H5QpbL079414@svn.freebsd.org>
From: Pyun YongHyeon 
Date: Fri, 17 Oct 2008 05:26:51 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183966 - head/sys/dev/mii
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 17 Oct 2008 05:26:52 -0000

Author: yongari
Date: Fri Oct 17 05:26:51 2008
New Revision: 183966
URL: http://svn.freebsd.org/changeset/base/183966

Log:
  Some 88E1149 PHY's page select is initialized to point to other
  bank instead of copper/fiber bank which in turn resulted in
  wrong registers were accessed during PHY operation. It is
  believed that page 0 should be used for copper PHY so reinitialize
  E1000_EADR to select default copper PHY.
  This fixes link establishment issue of nfe(4) on Sun Fire X4140.
  
  OpenBSD also has similimar patch but they just reset the E1000_EADR
  register to page 0. However some Marvell PHYs((88E3082, 88E1000)
  don't have the extended address register and the meaning of the
  register is quite different for each PHY model. So selecting copper
  PHY is limited to 88E1149 PHY which seems to be the only one that
  exhibits link establishment problem. If parent device know the type
  of PHY(either copper or fiber) that information should be notified
  to PHY driver but there is no good way to pass this information yet.
  
  Reported by:	thompsa
  Reviewed by:	thompsa

Modified:
  head/sys/dev/mii/e1000phy.c

Modified: head/sys/dev/mii/e1000phy.c
==============================================================================
--- head/sys/dev/mii/e1000phy.c	Fri Oct 17 03:59:25 2008	(r183965)
+++ head/sys/dev/mii/e1000phy.c	Fri Oct 17 05:26:51 2008	(r183966)
@@ -153,6 +153,20 @@ e1000phy_attach(device_t dev)
 		if (PHY_READ(sc, E1000_ESSR) & E1000_ESSR_FIBER_LINK)
 			sc->mii_flags |= MIIF_HAVEFIBER;
 		break;
+	case MII_MODEL_MARVELL_E1149:
+		/*
+		 * Some 88E1149 PHY's page select is initialized to
+		 * point to other bank instead of copper/fiber bank
+		 * which in turn resulted in wrong registers were
+		 * accessed during PHY operation. It is believed that
+		 * page 0 should be used for copper PHY so reinitialize
+		 * E1000_EADR to select default copper PHY. If parent
+		 * device know the type of PHY(either copper or fiber),
+		 * that information should be used to select default
+		 * type of PHY.
+		 */
+		PHY_WRITE(sc, E1000_EADR, 0);
+		break;
 	case MII_MODEL_MARVELL_E3082:
 		/* 88E3082 10/100 Fast Ethernet PHY. */
 		sc->mii_anegticks = MII_ANEGTICKS;

From owner-svn-src-head@FreeBSD.ORG  Fri Oct 17 07:04:29 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 875101065692;
	Fri, 17 Oct 2008 07:04:29 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 664918FC16;
	Fri, 17 Oct 2008 07:04:29 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9H74TlQ081106;
	Fri, 17 Oct 2008 07:04:29 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9H74TYZ081105;
	Fri, 17 Oct 2008 07:04:29 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <200810170704.m9H74TYZ081105@svn.freebsd.org>
From: Kip Macy 
Date: Fri, 17 Oct 2008 07:04:29 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183967 - head/sys/dev/cxgb
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 17 Oct 2008 07:04:29 -0000

Author: kmacy
Date: Fri Oct 17 07:04:29 2008
New Revision: 183967
URL: http://svn.freebsd.org/changeset/base/183967

Log:
  Track number of packets transmitted and number of packets received
  
  PR:	125806
  MFC after:	3 days

Modified:
  head/sys/dev/cxgb/cxgb_sge.c

Modified: head/sys/dev/cxgb/cxgb_sge.c
==============================================================================
--- head/sys/dev/cxgb/cxgb_sge.c	Fri Oct 17 05:26:51 2008	(r183966)
+++ head/sys/dev/cxgb/cxgb_sge.c	Fri Oct 17 07:04:29 2008	(r183967)
@@ -1887,7 +1887,11 @@ t3_free_tx_desc(struct sge_txq *q, int r
 			m_freem_iovec(&txsd->mi);	
 			buf_ring_scan(&q->txq_mr, txsd->mi.mi_base, __FILE__, __LINE__);
 			txsd->mi.mi_base = NULL;
-
+			/*
+			 * XXX check for cache hit rate here
+			 *
+			 */
+			q->port->ifp->if_opackets++;
 #if defined(DIAGNOSTIC) && 0
 			if (m_get_priority(txsd->m[0]) != cidx) 
 				printf("pri=%d cidx=%d\n",
@@ -2505,6 +2509,7 @@ t3_rx_eth(struct adapter *adap, struct s
 	
 	m->m_pkthdr.rcvif = ifp;
 	m->m_pkthdr.header = mtod(m, uint8_t *) + sizeof(*cpl) + ethpad;
+	ifp->if_ipackets++;
 #ifndef DISABLE_MBUF_IOVEC
 	m_explode(m);
 #endif	

From owner-svn-src-head@FreeBSD.ORG  Fri Oct 17 08:30:20 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EF76C106564A;
	Fri, 17 Oct 2008 08:30:20 +0000 (UTC)
	(envelope-from netchild@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id DF2128FC13;
	Fri, 17 Oct 2008 08:30:20 +0000 (UTC)
	(envelope-from netchild@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9H8UKfq082819;
	Fri, 17 Oct 2008 08:30:20 GMT
	(envelope-from netchild@svn.freebsd.org)
Received: (from netchild@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9H8UKtS082818;
	Fri, 17 Oct 2008 08:30:20 GMT
	(envelope-from netchild@svn.freebsd.org)
Message-Id: <200810170830.m9H8UKtS082818@svn.freebsd.org>
From: Alexander Leidinger 
Date: Fri, 17 Oct 2008 08:30:20 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183969 - in head/lib/libc: . stdlib
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 17 Oct 2008 08:30:21 -0000

Author: netchild
Date: Fri Oct 17 08:30:20 2008
New Revision: 183969
URL: http://svn.freebsd.org/changeset/base/183969

Log:
  MTC r183949:
   Allow to define MALLOC_PRODUCTION with a make variable instead of polluting
   the global CFLAGS.
  
  Reviewed by:	jasone

Modified:
  head/lib/libc/   (props changed)
  head/lib/libc/stdlib/Makefile.inc

Modified: head/lib/libc/stdlib/Makefile.inc
==============================================================================
--- head/lib/libc/stdlib/Makefile.inc	Fri Oct 17 07:39:27 2008	(r183968)
+++ head/lib/libc/stdlib/Makefile.inc	Fri Oct 17 08:30:20 2008	(r183969)
@@ -48,3 +48,8 @@ MLINKS+=strtoul.3 strtoull.3 strtoul.3 s
 MLINKS+=malloc.3 calloc.3 malloc.3 free.3 malloc.3 malloc.conf.5 \
 	malloc.3 realloc.3 malloc.3 reallocf.3 malloc.3 malloc_usable_size.3
 MLINKS+=tsearch.3 tdelete.3 tsearch.3 tfind.3 tsearch.3 twalk.3
+
+.if defined(MALLOC_PRODUCTION)
+CFLAGS+=	-DMALLOC_PRODUCTION
+.endif
+

From owner-svn-src-head@FreeBSD.ORG  Fri Oct 17 08:40:07 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D9107106568A;
	Fri, 17 Oct 2008 08:40:07 +0000 (UTC)
	(envelope-from bzeeb-lists@lists.zabbadoz.net)
Received: from mail.cksoft.de (mail.cksoft.de [62.111.66.27])
	by mx1.freebsd.org (Postfix) with ESMTP id 8F3D48FC18;
	Fri, 17 Oct 2008 08:40:07 +0000 (UTC)
	(envelope-from bzeeb-lists@lists.zabbadoz.net)
Received: from localhost (amavis.str.cksoft.de [192.168.74.71])
	by mail.cksoft.de (Postfix) with ESMTP id BD96F41C705;
	Fri, 17 Oct 2008 10:40:05 +0200 (CEST)
X-Virus-Scanned: amavisd-new at cksoft.de
Received: from mail.cksoft.de ([62.111.66.27])
	by localhost (amavis.str.cksoft.de [192.168.74.71]) (amavisd-new,
	port 10024)
	with ESMTP id tJ0Qml1UXwN9; Fri, 17 Oct 2008 10:40:05 +0200 (CEST)
Received: by mail.cksoft.de (Postfix, from userid 66)
	id 617C841C6DB; Fri, 17 Oct 2008 10:40:05 +0200 (CEST)
Received: from maildrop.int.zabbadoz.net (maildrop.int.zabbadoz.net
	[10.111.66.10])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mail.int.zabbadoz.net (Postfix) with ESMTP id 2C45344487F;
	Fri, 17 Oct 2008 08:39:48 +0000 (UTC)
Date: Fri, 17 Oct 2008 08:39:48 +0000 (UTC)
From: "Bjoern A. Zeeb" 
X-X-Sender: bz@maildrop.int.zabbadoz.net
To: Alexander Leidinger 
In-Reply-To: <200810170830.m9H8UKtS082818@svn.freebsd.org>
Message-ID: <20081017083900.I2978@maildrop.int.zabbadoz.net>
References: <200810170830.m9H8UKtS082818@svn.freebsd.org>
X-OpenPGP-Key: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r183969 - in head/lib/libc: . stdlib
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 17 Oct 2008 08:40:08 -0000

On Fri, 17 Oct 2008, Alexander Leidinger wrote:

> Author: netchild
> Date: Fri Oct 17 08:30:20 2008
> New Revision: 183969
> URL: http://svn.freebsd.org/changeset/base/183969
>
> Log:
>  MTC r183949:
>   Allow to define MALLOC_PRODUCTION with a make variable instead of polluting
>   the global CFLAGS.

I wonder if it would have been better to use the existing framework to
tunr on/off something that we use these days (src.conf)?


>  Reviewed by:	jasone
>
> Modified:
>  head/lib/libc/   (props changed)
>  head/lib/libc/stdlib/Makefile.inc
>
> Modified: head/lib/libc/stdlib/Makefile.inc
> ==============================================================================
> --- head/lib/libc/stdlib/Makefile.inc	Fri Oct 17 07:39:27 2008	(r183968)
> +++ head/lib/libc/stdlib/Makefile.inc	Fri Oct 17 08:30:20 2008	(r183969)
> @@ -48,3 +48,8 @@ MLINKS+=strtoul.3 strtoull.3 strtoul.3 s
> MLINKS+=malloc.3 calloc.3 malloc.3 free.3 malloc.3 malloc.conf.5 \
> 	malloc.3 realloc.3 malloc.3 reallocf.3 malloc.3 malloc_usable_size.3
> MLINKS+=tsearch.3 tdelete.3 tsearch.3 tfind.3 tsearch.3 twalk.3
> +
> +.if defined(MALLOC_PRODUCTION)
> +CFLAGS+=	-DMALLOC_PRODUCTION
> +.endif
> +
>

-- 
Bjoern A. Zeeb              Stop bit received. Insert coin for new game.

From owner-svn-src-head@FreeBSD.ORG  Fri Oct 17 08:58:34 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 391251065678;
	Fri, 17 Oct 2008 08:58:34 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 28EF98FC14;
	Fri, 17 Oct 2008 08:58:34 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9H8wY3w083302;
	Fri, 17 Oct 2008 08:58:34 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9H8wYCQ083301;
	Fri, 17 Oct 2008 08:58:34 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <200810170858.m9H8wYCQ083301@svn.freebsd.org>
From: "Bjoern A. Zeeb" 
Date: Fri, 17 Oct 2008 08:58:34 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183970 - head/sys/security/mac_partition
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 17 Oct 2008 08:58:34 -0000

Author: bz
Date: Fri Oct 17 08:58:33 2008
New Revision: 183970
URL: http://svn.freebsd.org/changeset/base/183970

Log:
  Use the label from the socket credential rather than the
  solabel which was not set by the mac_partition policy.
  
  Spotted by:	rwatson
  Reviewed by:	rwatson
  MFC after:	3 days

Modified:
  head/sys/security/mac_partition/mac_partition.c

Modified: head/sys/security/mac_partition/mac_partition.c
==============================================================================
--- head/sys/security/mac_partition/mac_partition.c	Fri Oct 17 08:30:20 2008	(r183969)
+++ head/sys/security/mac_partition/mac_partition.c	Fri Oct 17 08:58:33 2008	(r183970)
@@ -51,6 +51,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -248,7 +249,7 @@ partition_socket_check_visible(struct uc
 {
 	int error;
 
-	error = label_on_label(cred->cr_label, solabel);
+	error = label_on_label(cred->cr_label, so->so_cred->cr_label);
 
 	return (error ? ENOENT : 0);
 }

From owner-svn-src-head@FreeBSD.ORG  Fri Oct 17 12:54:29 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0183C1065689;
	Fri, 17 Oct 2008 12:54:29 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E20718FC08;
	Fri, 17 Oct 2008 12:54:28 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9HCsSrk088612;
	Fri, 17 Oct 2008 12:54:28 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9HCsS4Q088609;
	Fri, 17 Oct 2008 12:54:28 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <200810171254.m9HCsS4Q088609@svn.freebsd.org>
From: "Bjoern A. Zeeb" 
Date: Fri, 17 Oct 2008 12:54:28 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183973 - head/sys/security/mac
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 17 Oct 2008 12:54:29 -0000

Author: bz
Date: Fri Oct 17 12:54:28 2008
New Revision: 183973
URL: http://svn.freebsd.org/changeset/base/183973

Log:
  Add mac_inpcb_check_visible MAC Framework entry point, which is similar
  to mac_socket_check_visible but operates on the inpcb.
  
  Reviewed by:	rwatson
  MFC after:	3 months (set timer, decide then)

Modified:
  head/sys/security/mac/mac_framework.h
  head/sys/security/mac/mac_inet.c
  head/sys/security/mac/mac_policy.h

Modified: head/sys/security/mac/mac_framework.h
==============================================================================
--- head/sys/security/mac/mac_framework.h	Fri Oct 17 12:04:59 2008	(r183972)
+++ head/sys/security/mac/mac_framework.h	Fri Oct 17 12:54:28 2008	(r183973)
@@ -131,6 +131,7 @@ int	mac_ifnet_ioctl_set(struct ucred *cr
 	    struct ifnet *ifp);
 
 int	mac_inpcb_check_deliver(struct inpcb *inp, struct mbuf *m);
+int	mac_inpcb_check_visible(struct ucred *cred, struct inpcb *inp);
 void	mac_inpcb_create(struct socket *so, struct inpcb *inp);
 void	mac_inpcb_create_mbuf(struct inpcb *inp, struct mbuf *m);
 void	mac_inpcb_destroy(struct inpcb *);

Modified: head/sys/security/mac/mac_inet.c
==============================================================================
--- head/sys/security/mac/mac_inet.c	Fri Oct 17 12:04:59 2008	(r183972)
+++ head/sys/security/mac/mac_inet.c	Fri Oct 17 12:54:28 2008	(r183973)
@@ -313,6 +313,18 @@ mac_inpcb_check_deliver(struct inpcb *in
 	return (error);
 }
 
+int
+mac_inpcb_check_visible(struct ucred *cred, struct inpcb *inp)
+{
+	int error;
+
+	INP_LOCK_ASSERT(inp);
+
+	MAC_CHECK(inpcb_check_visible, cred, inp, inp->inp_label);
+
+	return (error);
+}
+
 void
 mac_inpcb_sosetlabel(struct socket *so, struct inpcb *inp)
 {

Modified: head/sys/security/mac/mac_policy.h
==============================================================================
--- head/sys/security/mac/mac_policy.h	Fri Oct 17 12:04:59 2008	(r183972)
+++ head/sys/security/mac/mac_policy.h	Fri Oct 17 12:54:28 2008	(r183973)
@@ -187,6 +187,8 @@ typedef void	(*mpo_ifnet_relabel_t)(stru
 typedef int	(*mpo_inpcb_check_deliver_t)(struct inpcb *inp,
 		    struct label *inplabel, struct mbuf *m,
 		    struct label *mlabel);
+typedef int	(*mpo_inpcb_check_visible_t)(struct ucred *cred,
+		    struct inpcb *inp, struct label *inplabel);
 typedef void	(*mpo_inpcb_create_t)(struct socket *so,
 		    struct label *solabel, struct inpcb *inp,
 		    struct label *inplabel);
@@ -689,6 +691,7 @@ struct mac_policy_ops {
 	mpo_ifnet_relabel_t			mpo_ifnet_relabel;
 
 	mpo_inpcb_check_deliver_t		mpo_inpcb_check_deliver;
+	mpo_inpcb_check_visible_t		mpo_inpcb_check_visible;
 	mpo_inpcb_create_t			mpo_inpcb_create;
 	mpo_inpcb_create_mbuf_t			mpo_inpcb_create_mbuf;
 	mpo_inpcb_destroy_label_t		mpo_inpcb_destroy_label;

From owner-svn-src-head@FreeBSD.ORG  Fri Oct 17 13:28:53 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EE12F1065686;
	Fri, 17 Oct 2008 13:28:53 +0000 (UTC)
	(envelope-from brooks@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D9D6B8FC0C;
	Fri, 17 Oct 2008 13:28:53 +0000 (UTC)
	(envelope-from brooks@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9HDSrlS089237;
	Fri, 17 Oct 2008 13:28:53 GMT (envelope-from brooks@svn.freebsd.org)
Received: (from brooks@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9HDSrAo089234;
	Fri, 17 Oct 2008 13:28:53 GMT (envelope-from brooks@svn.freebsd.org)
Message-Id: <200810171328.m9HDSrAo089234@svn.freebsd.org>
From: Brooks Davis 
Date: Fri, 17 Oct 2008 13:28:53 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183974 - head/sbin/dhclient
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 17 Oct 2008 13:28:54 -0000

Author: brooks
Date: Fri Oct 17 13:28:53 2008
New Revision: 183974
URL: http://svn.freebsd.org/changeset/base/183974

Log:
  Support the remaining options listed in dhcp-options(5) and RFC 2132.
  
  PR:		bin/127076
  Submitted by:	jkim
  MFC after:	1 week

Modified:
  head/sbin/dhclient/dhclient.c
  head/sbin/dhclient/dhcp.h
  head/sbin/dhclient/tables.c

Modified: head/sbin/dhclient/dhclient.c
==============================================================================
--- head/sbin/dhclient/dhclient.c	Fri Oct 17 12:54:28 2008	(r183973)
+++ head/sbin/dhclient/dhclient.c	Fri Oct 17 13:28:53 2008	(r183974)
@@ -2317,12 +2317,16 @@ check_option(struct client_lease *l, int
 	case DHO_NETBIOS_DD_SERVER:
 	case DHO_FONT_SERVERS:
 	case DHO_DHCP_SERVER_IDENTIFIER:
+	case DHO_NISPLUS_SERVERS:
+	case DHO_MOBILE_IP_HOME_AGENT:
 	case DHO_SMTP_SERVER:
 	case DHO_POP_SERVER:
 	case DHO_NNTP_SERVER:
 	case DHO_WWW_SERVER:
 	case DHO_FINGER_SERVER:
 	case DHO_IRC_SERVER:
+	case DHO_STREETTALK_SERVER:
+	case DHO_STREETTALK_DA_SERVER:
 		if (!ipv4addrs(opbuf)) {
 			warning("Invalid IP address in option: %s", opbuf);
 			return (0);
@@ -2330,6 +2334,8 @@ check_option(struct client_lease *l, int
 		return (1)  ;
 	case DHO_HOST_NAME:
 	case DHO_NIS_DOMAIN:
+	case DHO_NISPLUS_DOMAIN:
+	case DHO_TFTP_SERVER_NAME:
 		if (!res_hnok(sbuf)) {
 			warning("Bogus Host Name option %d: %s (%s)", option,
 			    sbuf, opbuf);
@@ -2388,6 +2394,7 @@ check_option(struct client_lease *l, int
 	case DHO_DHCP_REBINDING_TIME:
 	case DHO_DHCP_CLASS_IDENTIFIER:
 	case DHO_DHCP_CLIENT_IDENTIFIER:
+	case DHO_BOOTFILE_NAME:
 	case DHO_DHCP_USER_CLASS_ID:
 	case DHO_END:
 		return (1);

Modified: head/sbin/dhclient/dhcp.h
==============================================================================
--- head/sbin/dhclient/dhcp.h	Fri Oct 17 12:54:28 2008	(r183973)
+++ head/sbin/dhclient/dhcp.h	Fri Oct 17 13:28:53 2008	(r183974)
@@ -155,12 +155,19 @@ struct dhcp_packet {
 #define DHO_DHCP_REBINDING_TIME		59
 #define DHO_DHCP_CLASS_IDENTIFIER	60
 #define DHO_DHCP_CLIENT_IDENTIFIER	61
+#define	DHO_NISPLUS_DOMAIN		64
+#define	DHO_NISPLUS_SERVERS		65
+#define	DHO_TFTP_SERVER_NAME		66
+#define	DHO_BOOTFILE_NAME		67
+#define	DHO_MOBILE_IP_HOME_AGENT	68
 #define DHO_SMTP_SERVER			69
 #define DHO_POP_SERVER			70
 #define DHO_NNTP_SERVER			71
 #define DHO_WWW_SERVER			72
 #define DHO_FINGER_SERVER		73
 #define DHO_IRC_SERVER			74
+#define	DHO_STREETTALK_SERVER		75
+#define	DHO_STREETTALK_DA_SERVER	76
 #define DHO_DHCP_USER_CLASS_ID		77
 #define DHO_CLASSLESS_ROUTES		121
 #define DHO_END				255

Modified: head/sbin/dhclient/tables.c
==============================================================================
--- head/sbin/dhclient/tables.c	Fri Oct 17 12:54:28 2008	(r183973)
+++ head/sbin/dhclient/tables.c	Fri Oct 17 13:28:53 2008	(r183974)
@@ -387,13 +387,25 @@ unsigned char dhcp_option_default_priori
 	DHO_FONT_SERVERS,
 	DHO_X_DISPLAY_MANAGER,
 	DHO_DHCP_PARAMETER_REQUEST_LIST,
+	DHO_NISPLUS_DOMAIN,
+	DHO_NISPLUS_SERVERS,
+	DHO_TFTP_SERVER_NAME,
+	DHO_BOOTFILE_NAME,
+	DHO_MOBILE_IP_HOME_AGENT,
+	DHO_SMTP_SERVER,
+	DHO_POP_SERVER,
+	DHO_NNTP_SERVER,
+	DHO_WWW_SERVER,
+	DHO_FINGER_SERVER,
+	DHO_IRC_SERVER,
+	DHO_STREETTALK_SERVER,
+	DHO_STREETTALK_DA_SERVER,
 
 	/* Presently-undefined options... */
-	62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
-	78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
-	93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
-	107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118,
-	119, 120, 122, 123, 124, 125, 126, 127, 128, 129, 130,
+	62, 63, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
+	92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105,
+	106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
+	118, 119, 120, 122, 123, 124, 125, 126, 127, 128, 129, 130,
 	131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142,
 	143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154,
 	155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166,

From owner-svn-src-head@FreeBSD.ORG  Fri Oct 17 14:07:40 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 153A31065689;
	Fri, 17 Oct 2008 14:07:40 +0000 (UTC)
	(envelope-from philip@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 004738FC16;
	Fri, 17 Oct 2008 14:07:39 +0000 (UTC)
	(envelope-from philip@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9HE7d5c090042;
	Fri, 17 Oct 2008 14:07:39 GMT (envelope-from philip@svn.freebsd.org)
Received: (from philip@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9HE7dt9090040;
	Fri, 17 Oct 2008 14:07:39 GMT (envelope-from philip@svn.freebsd.org)
Message-Id: <200810171407.m9HE7dt9090040@svn.freebsd.org>
From: Philip Paeps 
Date: Fri, 17 Oct 2008 14:07:39 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183975 - head/share/syscons/keymaps
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 17 Oct 2008 14:07:40 -0000

Author: philip
Date: Fri Oct 17 14:07:39 2008
New Revision: 183975
URL: http://svn.freebsd.org/changeset/base/183975

Log:
  Add the nordic keyboard layout for Asus eee devices.
  
  PR:		126841
  Submitted by:	Peter 
  MFC after:	3 days

Added:
  head/share/syscons/keymaps/eee_nordic.kbd   (contents, props changed)
Modified:
  head/share/syscons/keymaps/INDEX.keymaps

Modified: head/share/syscons/keymaps/INDEX.keymaps
==============================================================================
--- head/share/syscons/keymaps/INDEX.keymaps	Fri Oct 17 13:28:53 2008	(r183974)
+++ head/share/syscons/keymaps/INDEX.keymaps	Fri Oct 17 14:07:39 2008	(r183975)
@@ -99,6 +99,8 @@ danish.cp865.kbd:fr:Danois Code page 865
 danish.cp865.kbd:pt:Dinamarquês Codepage 865
 danish.cp865.kbd:es:Danés Codepage 865
 
+eee_nordic.kbd:en:Nordic layout on Asus eeePC
+
 el.iso07.kbd:en:Greek ISO-8859-7 (104 keys)
 el.iso07.kbd:el:Åëëçíéêü ISO-8859-7 (104 ðëÞêôñùí)
 

Added: head/share/syscons/keymaps/eee_nordic.kbd
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/share/syscons/keymaps/eee_nordic.kbd	Fri Oct 17 14:07:39 2008	(r183975)
@@ -0,0 +1,131 @@
+# $FreeBSD$
+#                                                         alt
+# scan                       cntrl          alt    alt   cntrl lock
+# code  base   shift  cntrl  shift  alt    shift  cntrl  shift state
+# ------------------------------------------------------------------
+  000   nop    nop    nop    nop    nop    nop    nop    nop     O
+  001   esc    esc    esc    esc    esc    esc    debug  esc     O
+  002   '1'    '!'    nop    nop    nop    nop    nop    nop     O
+  003   '2'    '"'    nul    nul    '@'    '@'    nul    nul     O
+  004   '3'    '#'    nop    nop    163    nop    nop    nop     O
+  005   '4'    164    nop    nop    '$'    nop    nop    nop     O
+  006   '5'    '%'    nop    nop    nop    nop    nop    nop     O
+  007   '6'    '&'    nop    nop    nop    nop    nop    nop     O
+# Alt + Shift + 7 = ÷
+  008   '7'    '/'    nop    nop    '{'    '÷'    nop    nop     O
+  009   '8'    '('    nop    nop    '['    nop    nop    nop     O
+  010   '9'    ')'    nop    nop    ']'    nop    gs     nop     O
+  011   '0'    '='    nop    nop    '}'    nop    nop    nop     O
+  012   '+'    '?'    nop    nop    '\'    nop    fs     nop     O
+# For left of backspace key, gives with Alt=' and Alt+Shift+Key=|
+  013   128    '`'    nop    nop    39     '|'    nop    nop     O
+  014   bs     bs     del    del    bs     bs     del    del     O
+  015   ht     btab   nop    nop    ht     btab   nop    nop     O
+  016   'q'    'Q'    dc1    dc1    'q'    'Q'    dc1    dc1     C
+  017   'w'    'W'    etb    etb    'w'    'W'    etb    etb     C
+# Alt + Ctrl + E = French e (as in café)
+  018   'e'    'E'    enq    enq    164    'E'    'é'    enq     C
+# Alt + R = Copyright sign
+  019   'r'    'R'    dc2    dc2    '®'    'R'    dc2    dc2     C
+  020   't'    'T'    dc4    dc4    't'    'T'    dc4    dc4     C
+  021   'y'    'Y'    em     em     'y'    'Y'    em     em      C
+# Alt + U = Mikro,  Alt + Shift + U = German u
+  022   'u'    'U'    nak    nak    'µ'    'U'    'ü'    'Ü'     C
+  023   'i'    'I'    ht     ht     'i'    'I'    ht     ht      C
+# Alt + O = Norwegian/Danish Ö
+  024   'o'    'O'    si     si     'ø'    'Ø'    si     si      C
+# Alt + P = Pi
+  025   'p'    'P'    dle    dle    '¶'    'P'    dle    dle     C
+  026   229    197    nop    nop    '}'    ']'    nop    nop     C
+  027   168    '^'    nop    nop    '~'    nop    nop    nop     O
+  028   cr     cr     nl     nl     cr     cr     nl     nl      O
+  029   lctrl  lctrl  lctrl  lctrl  lctrl  lctrl  lctrl  lctrl   O
+# Alt + A = At sign,  Ctrl+Alt = ae,  Ctrl+Alt+Shift = AE
+  030   'a'    'A'    soh    soh    '@'    'A'    'æ'    'Æ'     C
+  031   's'    'S'    dc3    dc3    's'    'S'    dc3    dc3     C
+  032   'd'    'D'    eot    eot    'd'    'D'    eot    eot     C
+  033   'f'    'F'    ack    ack    'f'    'F'    ack    ack     C
+  034   'g'    'G'    bel    bel    'g'    'G'    bel    bel     C
+  035   'h'    'H'    bs     bs     'h'    'H'    bs     bs      C
+  036   'j'    'J'    nl     nl     'j'    'J'    nl     nl      C
+  037   'k'    'K'    vt     vt     'k'    'K'    vt     vt      C
+  038   'l'    'L'    ff     ff     'l'    'L'    ff     ff      C
+  039   246    214    nop    nop    '|'    '\'    nop    nop     C
+  040   228    196    nop    nop    '{'    '['    nop    nop     C
+  041   167    189    nop    nop    '\'    '|'    nop    nop     O
+  042   lshift lshift lshift lshift lshift lshift lshift lshift  O
+  043   '''    '*'    nop    nop    nop    nop    nop    nop     O
+# Alt + Z = Pipe
+  044   'z'    'Z'    sub    sub    '|'    'Z'    sub    sub     C
+  045   'x'    'X'    can    can    'x'    'X'    can    can     C
+  046   'c'    'C'    etx    etx    'c'    'C'    etx    etx     C
+  047   'v'    'V'    syn    syn    'v'    'V'    syn    syn     C
+# Ctrl + Shift + B = German B
+  048   'b'    'B'    stx    'ß'    'b'    'B'    stx    stx     C
+  049   'n'    'N'    so     so     'n'    'N'    so     so      C
+# Alt + M = Mikro
+  050   'm'    'M'    cr     cr     181    'M'    cr     cr      C
+# Alt + [,/;] = <
+  051   ','    ';'    nop    nop    '<'    '<'    nop    nop     O
+# Alt + [./:] = >
+  052   '.'    ':'    nop    nop    '>'    '>'    nop    nop     O
+  053   '-'    '_'    us     nop    '/'    '?'    nop    nop     O
+  054   rshift rshift rshift rshift rshift rshift rshift rshift  O
+  055   '*'    '*'    '*'    '*'    '*'    '*'    '*'    '*'     O
+  056   lalt   lalt   lalt   lalt   lalt   lalt   lalt   lalt    O
+  057   ' '    ' '    nul    ' '    ' '    ' '    susp   ' '     O
+  058   clock  clock  clock  clock  clock  clock  clock  clock   O
+  059   fkey01 fkey13 fkey25 fkey37 scr01  scr11  scr01  scr11   O
+  060   fkey02 fkey14 fkey26 fkey38 scr02  scr12  scr02  scr12   O
+  061   fkey03 fkey15 fkey27 fkey39 scr03  scr13  scr03  scr13   O
+  062   fkey04 fkey16 fkey28 fkey40 scr04  scr14  scr04  scr14   O
+  063   fkey05 fkey17 fkey29 fkey41 scr05  scr15  scr05  scr15   O
+  064   fkey06 fkey18 fkey30 fkey42 scr06  scr16  scr06  scr16   O
+  065   fkey07 fkey19 fkey31 fkey43 scr07  scr07  scr07  scr07   O
+  066   fkey08 fkey20 fkey32 fkey44 scr08  scr08  scr08  scr08   O
+  067   fkey09 fkey21 fkey33 fkey45 scr09  scr09  scr09  scr09   O
+  068   fkey10 fkey22 fkey34 fkey46 scr10  scr10  scr10  scr10   O
+  069   nlock  nlock  nlock  nlock  nlock  nlock  nlock  nlock   O
+  070   slock  slock  slock  slock  slock  slock  slock  slock   O
+  071   fkey49 '7'    '7'    '7'    '7'    '7'    '7'    '7'     N
+  072   fkey50 '8'    '8'    '8'    '8'    '8'    '8'    '8'     N
+  073   fkey51 '9'    '9'    '9'    '9'    '9'    '9'    '9'     N
+  074   fkey52 '-'    '-'    '-'    '-'    '-'    '-'    '-'     N
+  075   fkey53 '4'    '4'    '4'    '4'    '4'    '4'    '4'     N
+  076   fkey54 '5'    '5'    '5'    '5'    '5'    '5'    '5'     N
+  077   fkey55 '6'    '6'    '6'    '6'    '6'    '6'    '6'     N
+  078   fkey56 '+'    '+'    '+'    '+'    '+'    '+'    '+'     N
+  079   fkey57 '1'    '1'    '1'    '1'    '1'    '1'    '1'     N
+  080   fkey58 '2'    '2'    '2'    '2'    '2'    '2'    '2'     N
+  081   fkey59 '3'    '3'    '3'    '3'    '3'    '3'    '3'     N
+  082   fkey60 '0'    '0'    '0'    '0'    '0'    '0'    '0'     N
+  083   del    '.'    '.'    '.'    '.'    '.'    boot   boot    N
+  084   nop    nop    nop    nop    nop    nop    nop    nop     O
+  085   nop    nop    nop    nop    nop    nop    nop    nop     O
+  086   '<'    '>'    nop    nop    '|'    nop    nop    nop     O
+  087   fkey11 fkey23 fkey35 fkey47 scr11  scr11  scr11  scr11   O
+  088   fkey12 fkey24 fkey36 fkey48 scr12  scr12  scr12  scr12   O
+  089   cr     cr     nl     nl     cr     cr     nl     nl      O
+  090   rctrl  rctrl  rctrl  rctrl  rctrl  rctrl  rctrl  rctrl   O
+  091   '/'    '/'    '/'    '/'    '/'    '/'    '/'    '/'     N
+  092   nscr   pscr   debug  debug  nop    nop    nop    nop     O
+  093   ralt   ralt   ralt   ralt   ralt   ralt   ralt   ralt    O
+  094   fkey49 fkey49 fkey49 fkey49 fkey49 fkey49 fkey49 fkey49  O
+# Alt+Arrow up = Page up
+  095   fkey50 fkey50 fkey50 fkey50 fkey51 fkey50 fkey50 fkey50  O
+  096   fkey51 fkey51 fkey51 fkey51 fkey51 fkey51 fkey51 fkey51  O
+# Alt+Arrow left = Home
+  097   fkey53 fkey53 fkey53 fkey53 fkey49 fkey53 fkey53 fkey53  O
+# Alt+Arrow right = End
+  098   fkey55 fkey55 fkey55 fkey55 fkey57 fkey55 fkey55 fkey55  O
+  099   fkey57 fkey57 fkey57 fkey57 fkey57 fkey57 fkey57 fkey57  O
+# Alt+Arrow down = Page down
+  100   fkey58 fkey58 fkey58 fkey58 fkey59 fkey58 fkey58 fkey58  O
+  101   fkey59 fkey59 fkey59 fkey59 fkey59 fkey59 fkey59 fkey59  O
+  102   fkey60 paste  fkey60 fkey60 fkey60 fkey60 fkey60 fkey60  O
+  103	fkey61 fkey61 fkey61 fkey61 fkey61 fkey61 boot   fkey61  O
+  104   slock  saver  slock  saver  susp   nop    susp   nop     O
+  105   fkey62 fkey62 fkey62 fkey62 fkey62 fkey62 fkey62 fkey62  O
+  106   fkey63 fkey63 fkey63 fkey63 fkey63 fkey63 fkey63 fkey63  O
+  107   fkey64 fkey64 fkey64 fkey64 fkey64 fkey64 fkey64 fkey64  O
+  108   nop    nop    nop    nop    nop    nop    nop    nop     O

From owner-svn-src-head@FreeBSD.ORG  Fri Oct 17 14:37:58 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BCE6A106568B;
	Fri, 17 Oct 2008 14:37:58 +0000 (UTC)
	(envelope-from brooks@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A80D28FC44;
	Fri, 17 Oct 2008 14:37:58 +0000 (UTC)
	(envelope-from brooks@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9HEbw9d090641;
	Fri, 17 Oct 2008 14:37:58 GMT (envelope-from brooks@svn.freebsd.org)
Received: (from brooks@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9HEbwTP090639;
	Fri, 17 Oct 2008 14:37:58 GMT (envelope-from brooks@svn.freebsd.org)
Message-Id: <200810171437.m9HEbwTP090639@svn.freebsd.org>
From: Brooks Davis 
Date: Fri, 17 Oct 2008 14:37:58 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183976 - head/sys/dev/usb
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 17 Oct 2008 14:37:58 -0000

Author: brooks
Date: Fri Oct 17 14:37:58 2008
New Revision: 183976
URL: http://svn.freebsd.org/changeset/base/183976

Log:
  Wireless Mouse device of Sony VGP-WRC1 mouse/keyboard receiver has the
  same program interface as Microsoft Wireless Notebook Optical Mouse and
  needs a quirk.
  
  PR:		usb/122712
  MFC after:	3 days

Modified:
  head/sys/dev/usb/usb_quirks.c
  head/sys/dev/usb/usbdevs

Modified: head/sys/dev/usb/usb_quirks.c
==============================================================================
--- head/sys/dev/usb/usb_quirks.c	Fri Oct 17 14:07:39 2008	(r183975)
+++ head/sys/dev/usb/usb_quirks.c	Fri Oct 17 14:37:58 2008	(r183976)
@@ -90,6 +90,8 @@ static const struct usbd_quirk_entry {
    ANY, { UQ_MS_BAD_CLASS | UQ_MS_LEADING_BYTE }},
  { USB_VENDOR_MICROSOFT, USB_PRODUCT_MICROSOFT_WLINTELLIMOUSE,
    ANY, { UQ_MS_LEADING_BYTE }},
+ { USB_VENDOR_SONY, USB_PRODUCT_SONY_RF_RECEIVER,
+   ANY,{ UQ_MS_BAD_CLASS }},
 
  /* Devices which should be ignored by uhid */
  { USB_VENDOR_APC, USB_PRODUCT_APC_UPS,

Modified: head/sys/dev/usb/usbdevs
==============================================================================
--- head/sys/dev/usb/usbdevs	Fri Oct 17 14:07:39 2008	(r183975)
+++ head/sys/dev/usb/usbdevs	Fri Oct 17 14:37:58 2008	(r183976)
@@ -2232,6 +2232,7 @@ product SONY CLIE_41		0x009a	Sony Clie v
 product SONY CLIE_NX60		0x00da	Sony Clie nx60
 product SONY CLIE_TH55		0x0144	Sony Clie th55
 product SONY CLIE_TJ37		0x0169	Sony Clie tj37
+product SONY RF_RECEIVER	0x01db	Sony RF mouse/kbd Receiver VGP-WRC1
 
 /* Sony Ericsson products */
 product SONYERICSSON DCU10	0x0528	USB Cable

From owner-svn-src-head@FreeBSD.ORG  Fri Oct 17 14:40:04 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5765510656A5;
	Fri, 17 Oct 2008 14:40:04 +0000 (UTC)
	(envelope-from philip@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4315B8FC45;
	Fri, 17 Oct 2008 14:40:04 +0000 (UTC)
	(envelope-from philip@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9HEe4pK090724;
	Fri, 17 Oct 2008 14:40:04 GMT (envelope-from philip@svn.freebsd.org)
Received: (from philip@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9HEe4NB090723;
	Fri, 17 Oct 2008 14:40:04 GMT (envelope-from philip@svn.freebsd.org)
Message-Id: <200810171440.m9HEe4NB090723@svn.freebsd.org>
From: Philip Paeps 
Date: Fri, 17 Oct 2008 14:40:04 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183977 - head/usr.sbin/sysinstall
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 17 Oct 2008 14:40:04 -0000

Author: philip
Date: Fri Oct 17 14:40:03 2008
New Revision: 183977
URL: http://svn.freebsd.org/changeset/base/183977

Log:
  Adjust default keymaps for Ireland and Channel Islands.  They use the UK
  keymap.  You can learn some interesting things in the PR database!
  
  PR:		conf/124411
  Submitted by:	Doctor Modiford 
  MFC after:	3 days

Modified:
  head/usr.sbin/sysinstall/keymap.c

Modified: head/usr.sbin/sysinstall/keymap.c
==============================================================================
--- head/usr.sbin/sysinstall/keymap.c	Fri Oct 17 14:37:58 2008	(r183976)
+++ head/usr.sbin/sysinstall/keymap.c	Fri Oct 17 14:40:03 2008	(r183977)
@@ -82,6 +82,10 @@ keymapMenuSelect(dialogMenuItem *self)
 	{"se", "swedish"},
 	{"ch", "swiss"},
 	{"gb", "uk"},
+	{"gg", "uk"},
+	{"ie", "uk"},
+	{"im", "uk"},
+	{"je", "uk"},
 	{NULL, NULL}
     };
     const char *country, *lang;

From owner-svn-src-head@FreeBSD.ORG  Fri Oct 17 15:10:45 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C225F1065689;
	Fri, 17 Oct 2008 15:10:45 +0000 (UTC)
	(envelope-from brooks@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id AD4CC8FC19;
	Fri, 17 Oct 2008 15:10:45 +0000 (UTC)
	(envelope-from brooks@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9HFAjqF091326;
	Fri, 17 Oct 2008 15:10:45 GMT (envelope-from brooks@svn.freebsd.org)
Received: (from brooks@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9HFAjWf091325;
	Fri, 17 Oct 2008 15:10:45 GMT (envelope-from brooks@svn.freebsd.org)
Message-Id: <200810171510.m9HFAjWf091325@svn.freebsd.org>
From: Brooks Davis 
Date: Fri, 17 Oct 2008 15:10:45 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183979 - head/usr.sbin/pkg_install/add
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 17 Oct 2008 15:10:45 -0000

Author: brooks
Date: Fri Oct 17 15:10:45 2008
New Revision: 183979
URL: http://svn.freebsd.org/changeset/base/183979

Log:
  Display usage when pkg_add is called with no arguments.
  
  PR:		bin/121093
  Submitted by:	volker
  Approved by:	portmgr (linimon)
  MFC after:	3 days

Modified:
  head/usr.sbin/pkg_install/add/main.c

Modified: head/usr.sbin/pkg_install/add/main.c
==============================================================================
--- head/usr.sbin/pkg_install/add/main.c	Fri Oct 17 15:06:34 2008	(r183978)
+++ head/usr.sbin/pkg_install/add/main.c	Fri Oct 17 15:10:45 2008	(r183979)
@@ -259,7 +259,7 @@ main(int argc, char **argv)
 	}
     }
     /* If no packages, yelp */
-    else if (!ch) {
+    if (!ch) {
 	warnx("missing package name(s)");
 	usage();
     }

From owner-svn-src-head@FreeBSD.ORG  Fri Oct 17 15:11:12 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A2E841065687;
	Fri, 17 Oct 2008 15:11:12 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8C1C48FC0A;
	Fri, 17 Oct 2008 15:11:12 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9HFBCg8091391;
	Fri, 17 Oct 2008 15:11:12 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9HFBC6c091384;
	Fri, 17 Oct 2008 15:11:12 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <200810171511.m9HFBC6c091384@svn.freebsd.org>
From: "Bjoern A. Zeeb" 
Date: Fri, 17 Oct 2008 15:11:12 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183980 - in head/sys/security: mac_biba mac_lomac
	mac_mls mac_partition mac_seeotheruids mac_stub mac_test
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 17 Oct 2008 15:11:12 -0000

Author: bz
Date: Fri Oct 17 15:11:12 2008
New Revision: 183980
URL: http://svn.freebsd.org/changeset/base/183980

Log:
  Add a mac_inpcb_check_visible implementation to all MAC policies
  that handle mac_socket_check_visible.
  
  Reviewed by:	rwatson
  MFC after:	3 months (set timer; decide then)

Modified:
  head/sys/security/mac_biba/mac_biba.c
  head/sys/security/mac_lomac/mac_lomac.c
  head/sys/security/mac_mls/mac_mls.c
  head/sys/security/mac_partition/mac_partition.c
  head/sys/security/mac_seeotheruids/mac_seeotheruids.c
  head/sys/security/mac_stub/mac_stub.c
  head/sys/security/mac_test/mac_test.c

Modified: head/sys/security/mac_biba/mac_biba.c
==============================================================================
--- head/sys/security/mac_biba/mac_biba.c	Fri Oct 17 15:10:45 2008	(r183979)
+++ head/sys/security/mac_biba/mac_biba.c	Fri Oct 17 15:11:12 2008	(r183980)
@@ -1115,6 +1115,24 @@ biba_inpcb_check_deliver(struct inpcb *i
 	return (biba_equal_effective(p, i) ? 0 : EACCES);
 }
 
+static int
+biba_inpcb_check_visible(struct ucred *cred, struct inpcb *inp,
+    struct label *inplabel)
+{
+	struct mac_biba *subj, *obj;
+
+	if (!biba_enabled)
+		return (0);
+
+	subj = SLOT(cred->cr_label);
+	obj = SLOT(inplabel);
+
+	if (!biba_dominate_effective(obj, subj))
+		return (ENOENT);
+
+	return (0);
+}
+
 static void
 biba_inpcb_create(struct socket *so, struct label *solabel,
     struct inpcb *inp, struct label *inplabel)
@@ -3300,6 +3318,7 @@ static struct mac_policy_ops mac_biba_op
 	.mpo_ifnet_relabel = biba_ifnet_relabel,
 
 	.mpo_inpcb_check_deliver = biba_inpcb_check_deliver,
+	.mpo_inpcb_check_visible = biba_inpcb_check_visible,
 	.mpo_inpcb_create = biba_inpcb_create,
 	.mpo_inpcb_create_mbuf = biba_inpcb_create_mbuf,
 	.mpo_inpcb_destroy_label = biba_destroy_label,

Modified: head/sys/security/mac_lomac/mac_lomac.c
==============================================================================
--- head/sys/security/mac_lomac/mac_lomac.c	Fri Oct 17 15:10:45 2008	(r183979)
+++ head/sys/security/mac_lomac/mac_lomac.c	Fri Oct 17 15:11:12 2008	(r183980)
@@ -1244,6 +1244,24 @@ lomac_inpcb_check_deliver(struct inpcb *
 	return (lomac_equal_single(p, i) ? 0 : EACCES);
 }
 
+static int
+lomac_inpcb_check_visible(struct ucred *cred, struct inpcb *inp,
+    struct label *inplabel)
+{
+	struct mac_lomac *subj, *obj;
+
+	if (!lomac_enabled)
+		return (0);
+
+	subj = SLOT(cred->cr_label);
+	obj = SLOT(inplabel);
+
+	if (!lomac_dominate_single(obj, subj))
+		return (ENOENT);
+
+	return (0);
+}
+
 static void
 lomac_inpcb_create(struct socket *so, struct label *solabel,
     struct inpcb *inp, struct label *inplabel)
@@ -2861,6 +2879,7 @@ static struct mac_policy_ops lomac_ops =
 	.mpo_syncache_init_label = lomac_init_label_waitcheck,
 
 	.mpo_inpcb_check_deliver = lomac_inpcb_check_deliver,
+	.mpo_inpcb_check_visible = lomac_inpcb_check_visible,
 	.mpo_inpcb_create = lomac_inpcb_create,
 	.mpo_inpcb_create_mbuf = lomac_inpcb_create_mbuf,
 	.mpo_inpcb_destroy_label = lomac_destroy_label,

Modified: head/sys/security/mac_mls/mac_mls.c
==============================================================================
--- head/sys/security/mac_mls/mac_mls.c	Fri Oct 17 15:10:45 2008	(r183979)
+++ head/sys/security/mac_mls/mac_mls.c	Fri Oct 17 15:11:12 2008	(r183980)
@@ -1033,6 +1033,24 @@ mls_inpcb_check_deliver(struct inpcb *in
 	return (mls_equal_effective(p, i) ? 0 : EACCES);
 }
 
+static int
+mls_inpcb_check_visible(struct ucred *cred, struct inpcb *inp,
+    struct label *inplabel)
+{
+	struct mac_mls *subj, *obj;
+
+	if (!mls_enabled)
+		return (0);
+
+	subj = SLOT(cred->cr_label);
+	obj = SLOT(inplabel);
+
+	if (!mls_dominate_effective(subj, obj))
+		return (ENOENT);
+
+	return (0);
+}
+
 static void
 mls_inpcb_create(struct socket *so, struct label *solabel, struct inpcb *inp,
     struct label *inplabel)
@@ -2923,6 +2941,7 @@ static struct mac_policy_ops mls_ops =
 	.mpo_ifnet_relabel = mls_ifnet_relabel,
 
 	.mpo_inpcb_check_deliver = mls_inpcb_check_deliver,
+	.mpo_inpcb_check_visible = mls_inpcb_check_visible,
 	.mpo_inpcb_create = mls_inpcb_create,
 	.mpo_inpcb_create_mbuf = mls_inpcb_create_mbuf,
 	.mpo_inpcb_destroy_label = mls_destroy_label,

Modified: head/sys/security/mac_partition/mac_partition.c
==============================================================================
--- head/sys/security/mac_partition/mac_partition.c	Fri Oct 17 15:10:45 2008	(r183979)
+++ head/sys/security/mac_partition/mac_partition.c	Fri Oct 17 15:11:12 2008	(r183980)
@@ -51,10 +51,15 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 
+#include 
+#include 
+#include 
+
 #include 
 #include 
 
@@ -199,6 +204,17 @@ partition_cred_relabel(struct ucred *cre
 }
 
 static int
+partition_inpcb_check_visible(struct ucred *cred, struct inpcb *inp,
+    struct label *inplabel)
+{
+	int error;
+
+	error = label_on_label(cred->cr_label, inp->inp_cred->cr_label);
+
+	return (error ? ENOENT : 0);
+}
+
+static int
 partition_proc_check_debug(struct ucred *cred, struct proc *p)
 {
 	int error;
@@ -283,6 +299,7 @@ static struct mac_policy_ops partition_o
 	.mpo_cred_init_label = partition_cred_init_label,
 	.mpo_cred_internalize_label = partition_cred_internalize_label,
 	.mpo_cred_relabel = partition_cred_relabel,
+	.mpo_inpcb_check_visible = partition_inpcb_check_visible,
 	.mpo_proc_check_debug = partition_proc_check_debug,
 	.mpo_proc_check_sched = partition_proc_check_sched,
 	.mpo_proc_check_signal = partition_proc_check_signal,

Modified: head/sys/security/mac_seeotheruids/mac_seeotheruids.c
==============================================================================
--- head/sys/security/mac_seeotheruids/mac_seeotheruids.c	Fri Oct 17 15:10:45 2008	(r183979)
+++ head/sys/security/mac_seeotheruids/mac_seeotheruids.c	Fri Oct 17 15:11:12 2008	(r183980)
@@ -51,9 +51,14 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
+#include 
+#include 
+#include 
+
 #include 
 
 SYSCTL_DECL(_security_mac);
@@ -155,6 +160,14 @@ seeotheruids_cred_check_visible(struct u
 }
 
 static int
+seeotheruids_inpcb_check_visible(struct ucred *cred, struct inpcb *inp,
+    struct label *inplabel)
+{
+
+	return (seeotheruids_check(cred, inp->inp_cred));
+}
+
+static int
 seeotheruids_socket_check_visible(struct ucred *cred, struct socket *so,
     struct label *solabel)
 {
@@ -168,6 +181,7 @@ static struct mac_policy_ops seeotheruid
 	.mpo_proc_check_sched = seeotheruids_proc_check_sched,
 	.mpo_proc_check_signal = seeotheruids_proc_check_signal,
 	.mpo_cred_check_visible = seeotheruids_cred_check_visible,
+	.mpo_inpcb_check_visible = seeotheruids_inpcb_check_visible,
 	.mpo_socket_check_visible = seeotheruids_socket_check_visible,
 };
 

Modified: head/sys/security/mac_stub/mac_stub.c
==============================================================================
--- head/sys/security/mac_stub/mac_stub.c	Fri Oct 17 15:10:45 2008	(r183979)
+++ head/sys/security/mac_stub/mac_stub.c	Fri Oct 17 15:11:12 2008	(r183980)
@@ -859,6 +859,14 @@ stub_socket_check_stat(struct ucred *cre
 }
 
 static int
+stub_inpcb_check_visible(struct ucred *cred, struct inpcb *inp,
+   struct label *inplabel)
+{
+
+	return (0);
+}
+
+static int
 stub_socket_check_visible(struct ucred *cred, struct socket *so,
    struct label *solabel)
 {
@@ -1531,6 +1539,7 @@ static struct mac_policy_ops stub_ops =
 	.mpo_ifnet_relabel = stub_ifnet_relabel,
 
 	.mpo_inpcb_check_deliver = stub_inpcb_check_deliver,
+	.mpo_inpcb_check_visible = stub_inpcb_check_visible,
 	.mpo_inpcb_create = stub_inpcb_create,
 	.mpo_inpcb_create_mbuf = stub_inpcb_create_mbuf,
 	.mpo_inpcb_destroy_label = stub_destroy_label,

Modified: head/sys/security/mac_test/mac_test.c
==============================================================================
--- head/sys/security/mac_test/mac_test.c	Fri Oct 17 15:10:45 2008	(r183979)
+++ head/sys/security/mac_test/mac_test.c	Fri Oct 17 15:11:12 2008	(r183980)
@@ -494,6 +494,19 @@ test_inpcb_check_deliver(struct inpcb *i
 	return (0);
 }
 
+COUNTER_DECL(inpcb_check_visible);
+static int
+test_inpcb_check_visible(struct ucred *cred, struct inpcb *inp,
+    struct label *inplabel)
+{
+
+	LABEL_CHECK(cred->cr_label, MAGIC_CRED);
+	LABEL_CHECK(inplabel, MAGIC_INPCB);
+	COUNTER_INC(inpcb_check_visible);
+
+	return (0);
+}
+
 COUNTER_DECL(inpcb_create);
 static void
 test_inpcb_create(struct socket *so, struct label *solabel,
@@ -2840,6 +2853,7 @@ static struct mac_policy_ops test_ops =
 	.mpo_sysvshm_init_label = test_sysvshm_init_label,
 
 	.mpo_inpcb_check_deliver = test_inpcb_check_deliver,
+	.mpo_inpcb_check_visible = test_inpcb_check_visible,
 	.mpo_inpcb_create = test_inpcb_create,
 	.mpo_inpcb_create_mbuf = test_inpcb_create_mbuf,
 	.mpo_inpcb_destroy_label = test_inpcb_destroy_label,

From owner-svn-src-head@FreeBSD.ORG  Fri Oct 17 16:03:38 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4C4F71065687;
	Fri, 17 Oct 2008 16:03:38 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 373428FC18;
	Fri, 17 Oct 2008 16:03:38 +0000 (UTC) (envelope-from jhb@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9HG3c8g092297;
	Fri, 17 Oct 2008 16:03:38 GMT (envelope-from jhb@svn.freebsd.org)
Received: (from jhb@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9HG3buK092293;
	Fri, 17 Oct 2008 16:03:37 GMT (envelope-from jhb@svn.freebsd.org)
Message-Id: <200810171603.m9HG3buK092293@svn.freebsd.org>
From: John Baldwin 
Date: Fri, 17 Oct 2008 16:03:37 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183981 - head/sys/dev/ata/chipsets
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 17 Oct 2008 16:03:38 -0000

Author: jhb
Date: Fri Oct 17 16:03:37 2008
New Revision: 183981
URL: http://svn.freebsd.org/changeset/base/183981

Log:
  - For chipsets that can't do 64k transfers, fall back to 32k transfers
    (still a power of 2) rather than 63k transfers.  Even with 63k transfers
    some machines (such as Dell SC1435's) were experiencing chronic data
    corruption.
  - Use the MIO method to talk to the Serverworks HT1000_S1 SATA controller
    like all the other SATA controllers rather than the compat PATA
    method.  This lets the controller see all 4 SATA ports and also
    matches the behavior of the Linux driver.
  
  Silence from:	sos
  MFC after:	3 days

Modified:
  head/sys/dev/ata/chipsets/ata-cyrix.c
  head/sys/dev/ata/chipsets/ata-marvell.c
  head/sys/dev/ata/chipsets/ata-national.c
  head/sys/dev/ata/chipsets/ata-serverworks.c

Modified: head/sys/dev/ata/chipsets/ata-cyrix.c
==============================================================================
--- head/sys/dev/ata/chipsets/ata-cyrix.c	Fri Oct 17 15:11:12 2008	(r183980)
+++ head/sys/dev/ata/chipsets/ata-cyrix.c	Fri Oct 17 16:03:37 2008	(r183981)
@@ -109,7 +109,7 @@ ata_cyrix_setmode(device_t dev, int mode
 	/* dont try to set the mode if we dont have the resource */
 	if (ctlr->r_res1) {
 	    ch->dma.alignment = 16;
-	    ch->dma.max_iosize = 126 * DEV_BSIZE;
+	    ch->dma.max_iosize = 64 * DEV_BSIZE;
 
 	    if (mode >= ATA_UDMA0) {
 		ATA_OUTL(ch->r_io[ATA_BMCMD_PORT].res,

Modified: head/sys/dev/ata/chipsets/ata-marvell.c
==============================================================================
--- head/sys/dev/ata/chipsets/ata-marvell.c	Fri Oct 17 15:11:12 2008	(r183980)
+++ head/sys/dev/ata/chipsets/ata-marvell.c	Fri Oct 17 16:03:37 2008	(r183981)
@@ -536,7 +536,7 @@ ata_marvell_edma_dmainit(device_t dev)
 	ch->dma.max_address = BUS_SPACE_MAXADDR;
 
     /* chip does not reliably do 64K DMA transfers */
-    ch->dma.max_iosize = 126 * DEV_BSIZE; 
+    ch->dma.max_iosize = 64 * DEV_BSIZE; 
 }
 
 ATA_DECLARE_DRIVER(ata_marvell);

Modified: head/sys/dev/ata/chipsets/ata-national.c
==============================================================================
--- head/sys/dev/ata/chipsets/ata-national.c	Fri Oct 17 15:11:12 2008	(r183980)
+++ head/sys/dev/ata/chipsets/ata-national.c	Fri Oct 17 16:03:37 2008	(r183981)
@@ -101,7 +101,7 @@ ata_national_setmode(device_t dev, int m
     int error;
 
     ch->dma.alignment = 16;
-    ch->dma.max_iosize = 126 * DEV_BSIZE;
+    ch->dma.max_iosize = 64 * DEV_BSIZE;
 
     mode = ata_limit_mode(dev, mode, ATA_UDMA2);
 

Modified: head/sys/dev/ata/chipsets/ata-serverworks.c
==============================================================================
--- head/sys/dev/ata/chipsets/ata-serverworks.c	Fri Oct 17 15:11:12 2008	(r183980)
+++ head/sys/dev/ata/chipsets/ata-serverworks.c	Fri Oct 17 16:03:37 2008	(r183981)
@@ -79,7 +79,7 @@ ata_serverworks_probe(device_t dev)
      { ATA_CSB6,      0x00, SWKS_100, 0, ATA_UDMA5, "CSB6" },
      { ATA_CSB6_1,    0x00, SWKS_66,  0, ATA_UDMA4, "CSB6" },
      { ATA_HT1000,    0x00, SWKS_100, 0, ATA_UDMA5, "HT1000" },
-     { ATA_HT1000_S1, 0x00, SWKS_100, 4, ATA_SA150, "HT1000" },
+     { ATA_HT1000_S1, 0x00, SWKS_MIO, 4, ATA_SA150, "HT1000" },
      { ATA_HT1000_S2, 0x00, SWKS_MIO, 4, ATA_SA150, "HT1000" },
      { ATA_K2,        0x00, SWKS_MIO, 4, ATA_SA150, "K2" },
      { ATA_FRODO4,    0x00, SWKS_MIO, 4, ATA_SA150, "Frodo4" },
@@ -184,7 +184,7 @@ ata_serverworks_allocate(device_t dev)
     ch->hw.tf_write = ata_serverworks_tf_write;
 
     /* chip does not reliably do 64K DMA transfers */
-    ch->dma.max_iosize = 126 * DEV_BSIZE;
+    ch->dma.max_iosize = 64 * DEV_BSIZE;
 
     return 0;
 }

From owner-svn-src-head@FreeBSD.ORG  Fri Oct 17 16:26:17 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 309E0106568E;
	Fri, 17 Oct 2008 16:26:17 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 1423B8FC17;
	Fri, 17 Oct 2008 16:26:17 +0000 (UTC) (envelope-from bz@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9HGQGCD092753;
	Fri, 17 Oct 2008 16:26:16 GMT (envelope-from bz@svn.freebsd.org)
Received: (from bz@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9HGQG6v092747;
	Fri, 17 Oct 2008 16:26:16 GMT (envelope-from bz@svn.freebsd.org)
Message-Id: <200810171626.m9HGQG6v092747@svn.freebsd.org>
From: "Bjoern A. Zeeb" 
Date: Fri, 17 Oct 2008 16:26:16 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183982 - in head/sys: kern netinet sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 17 Oct 2008 16:26:17 -0000

Author: bz
Date: Fri Oct 17 16:26:16 2008
New Revision: 183982
URL: http://svn.freebsd.org/changeset/base/183982

Log:
  Add cr_canseeinpcb() doing checks using the cached socket
  credentials from inp_cred which is also available after the
  socket is gone.
  Switch cr_canseesocket consumers to cr_canseeinpcb.
  This removes an extra acquisition of the socket lock.
  
  Reviewed by:	rwatson
  MFC after:	3 months (set timer; decide then)

Modified:
  head/sys/kern/kern_prot.c
  head/sys/netinet/ip_divert.c
  head/sys/netinet/raw_ip.c
  head/sys/netinet/tcp_subr.c
  head/sys/netinet/udp_usrreq.c
  head/sys/sys/systm.h

Modified: head/sys/kern/kern_prot.c
==============================================================================
--- head/sys/kern/kern_prot.c	Fri Oct 17 16:03:37 2008	(r183981)
+++ head/sys/kern/kern_prot.c	Fri Oct 17 16:26:16 2008	(r183982)
@@ -45,6 +45,8 @@
 __FBSDID("$FreeBSD$");
 
 #include "opt_compat.h"
+#include "opt_inet.h"
+#include "opt_inet6.h"
 #include "opt_mac.h"
 
 #include 
@@ -68,6 +70,11 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#if defined(INET) || defined(INET6)
+#include 
+#include 
+#endif
+
 #include 
 #include 
 
@@ -1704,6 +1711,34 @@ cr_canseesocket(struct ucred *cred, stru
 	return (0);
 }
 
+#if defined(INET) || defined(INET6)
+/*-
+ * Determine whether the subject represented by cred can "see" a socket.
+ * Returns: 0 for permitted, ENOENT otherwise.
+ */
+int
+cr_canseeinpcb(struct ucred *cred, struct inpcb *inp)
+{
+	int error;
+
+	error = prison_check(cred, inp->inp_cred);
+	if (error)
+		return (ENOENT);
+#ifdef MAC
+	INP_LOCK_ASSERT(inp);
+	error = mac_inpcb_check_visible(cred, inp);
+	if (error)
+		return (error);
+#endif
+	if (cr_seeotheruids(cred, inp->inp_cred))
+		return (ENOENT);
+	if (cr_seeothergids(cred, inp->inp_cred))
+		return (ENOENT);
+
+	return (0);
+}
+#endif
+
 /*-
  * Determine whether td can wait for the exit of p.
  * Returns: 0 for permitted, an errno value otherwise

Modified: head/sys/netinet/ip_divert.c
==============================================================================
--- head/sys/netinet/ip_divert.c	Fri Oct 17 16:03:37 2008	(r183981)
+++ head/sys/netinet/ip_divert.c	Fri Oct 17 16:26:16 2008	(r183982)
@@ -627,7 +627,7 @@ div_pcblist(SYSCTL_HANDLER_ARGS)
 	     inp = LIST_NEXT(inp, inp_list)) {
 		INP_RLOCK(inp);
 		if (inp->inp_gencnt <= gencnt &&
-		    cr_canseesocket(req->td->td_ucred, inp->inp_socket) == 0)
+		    cr_canseeinpcb(req->td->td_ucred, inp) == 0)
 			inp_list[i++] = inp;
 		INP_RUNLOCK(inp);
 	}

Modified: head/sys/netinet/raw_ip.c
==============================================================================
--- head/sys/netinet/raw_ip.c	Fri Oct 17 16:03:37 2008	(r183981)
+++ head/sys/netinet/raw_ip.c	Fri Oct 17 16:26:16 2008	(r183982)
@@ -942,7 +942,7 @@ rip_pcblist(SYSCTL_HANDLER_ARGS)
 	     inp = LIST_NEXT(inp, inp_list)) {
 		INP_RLOCK(inp);
 		if (inp->inp_gencnt <= gencnt &&
-		    cr_canseesocket(req->td->td_ucred, inp->inp_socket) == 0) {
+		    cr_canseeinpcb(req->td->td_ucred, inp) == 0) {
 			/* XXX held references? */
 			inp_list[i++] = inp;
 		}

Modified: head/sys/netinet/tcp_subr.c
==============================================================================
--- head/sys/netinet/tcp_subr.c	Fri Oct 17 16:03:37 2008	(r183981)
+++ head/sys/netinet/tcp_subr.c	Fri Oct 17 16:26:16 2008	(r183982)
@@ -1015,8 +1015,7 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS)
 				else
 					error = EINVAL;	/* Skip this inp. */
 			} else
-				error = cr_canseesocket(req->td->td_ucred,
-				    inp->inp_socket);
+				error = cr_canseeinpcb(req->td->td_ucred, inp);
 			if (error == 0)
 				inp_list[i++] = inp;
 		}
@@ -1104,8 +1103,7 @@ tcp_getcred(SYSCTL_HANDLER_ARGS)
 		if (inp->inp_socket == NULL)
 			error = ENOENT;
 		if (error == 0)
-			error = cr_canseesocket(req->td->td_ucred,
-			    inp->inp_socket);
+			error = cr_canseeinpcb(req->td->td_ucred, inp);
 		if (error == 0)
 			cru2x(inp->inp_cred, &xuc);
 		INP_RUNLOCK(inp);
@@ -1168,8 +1166,7 @@ tcp6_getcred(SYSCTL_HANDLER_ARGS)
 		if (inp->inp_socket == NULL)
 			error = ENOENT;
 		if (error == 0)
-			error = cr_canseesocket(req->td->td_ucred,
-			    inp->inp_socket);
+			error = cr_canseeinpcb(req->td->td_ucred, inp);
 		if (error == 0)
 			cru2x(inp->inp_cred, &xuc);
 		INP_RUNLOCK(inp);

Modified: head/sys/netinet/udp_usrreq.c
==============================================================================
--- head/sys/netinet/udp_usrreq.c	Fri Oct 17 16:03:37 2008	(r183981)
+++ head/sys/netinet/udp_usrreq.c	Fri Oct 17 16:26:16 2008	(r183982)
@@ -688,7 +688,7 @@ udp_pcblist(SYSCTL_HANDLER_ARGS)
 	     inp = LIST_NEXT(inp, inp_list)) {
 		INP_RLOCK(inp);
 		if (inp->inp_gencnt <= gencnt &&
-		    cr_canseesocket(req->td->td_ucred, inp->inp_socket) == 0)
+		    cr_canseeinpcb(req->td->td_ucred, inp) == 0)
 			inp_list[i++] = inp;
 		INP_RUNLOCK(inp);
 	}
@@ -758,8 +758,7 @@ udp_getcred(SYSCTL_HANDLER_ARGS)
 		if (inp->inp_socket == NULL)
 			error = ENOENT;
 		if (error == 0)
-			error = cr_canseesocket(req->td->td_ucred,
-			    inp->inp_socket);
+			error = cr_canseeinpcb(req->td->td_ucred, inp);
 		if (error == 0)
 			cru2x(inp->inp_cred, &xuc);
 		INP_RUNLOCK(inp);

Modified: head/sys/sys/systm.h
==============================================================================
--- head/sys/sys/systm.h	Fri Oct 17 16:03:37 2008	(r183981)
+++ head/sys/sys/systm.h	Fri Oct 17 16:26:16 2008	(r183982)
@@ -112,6 +112,7 @@ extern char **kenvp;
  * General function declarations.
  */
 
+struct inpcb;
 struct lock_object;
 struct malloc_type;
 struct mtx;
@@ -227,6 +228,7 @@ void	cpu_stopprofclock(void);
 
 int	cr_cansee(struct ucred *u1, struct ucred *u2);
 int	cr_canseesocket(struct ucred *cred, struct socket *so);
+int	cr_canseeinpcb(struct ucred *cred, struct inpcb *inp);
 
 char	*getenv(const char *name);
 void	freeenv(char *env);

From owner-svn-src-head@FreeBSD.ORG  Fri Oct 17 18:42:46 2008
Return-Path: 
Delivered-To: svn-src-head@FreeBSD.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B8F371065688;
	Fri, 17 Oct 2008 18:42:46 +0000 (UTC)
	(envelope-from scottl@samsco.org)
Received: from pooker.samsco.org (pooker.samsco.org [168.103.85.57])
	by mx1.freebsd.org (Postfix) with ESMTP id 6BB0B8FC15;
	Fri, 17 Oct 2008 18:42:46 +0000 (UTC)
	(envelope-from scottl@samsco.org)
Received: from pooker.samsco.home (pooker.samsco.home [192.168.254.1])
	by pooker.samsco.org (8.14.2/8.14.2) with ESMTP id m9HIgg4p062391;
	Fri, 17 Oct 2008 12:42:43 -0600 (MDT)
	(envelope-from scottl@samsco.org)
Date: Fri, 17 Oct 2008 12:42:42 -0600 (MDT)
From: Scott Long 
To: John Baldwin 
In-Reply-To: <200810171603.m9HG3buK092293@svn.freebsd.org>
Message-ID: <20081017123919.C22184@pooker.samsco.org>
References: <200810171603.m9HG3buK092293@svn.freebsd.org>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
X-Spam-Status: No, score=-4.4 required=3.8 tests=ALL_TRUSTED,BAYES_00
	autolearn=ham version=3.1.8
X-Spam-Checker-Version: SpamAssassin 3.1.8 (2007-02-13) on pooker.samsco.org
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
	src-committers@FreeBSD.org
Subject: Re: svn commit: r183981 - head/sys/dev/ata/chipsets
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 17 Oct 2008 18:42:46 -0000

On Fri, 17 Oct 2008, John Baldwin wrote:
> Author: jhb
> Date: Fri Oct 17 16:03:37 2008
> New Revision: 183981
> URL: http://svn.freebsd.org/changeset/base/183981
>
> Log:
>  - For chipsets that can't do 64k transfers, fall back to 32k transfers
>    (still a power of 2) rather than 63k transfers.  Even with 63k transfers
>    some machines (such as Dell SC1435's) were experiencing chronic data
>    corruption.

It should be noted that breaking a 64K transfer into two 32K transfers is 
much more ideal than breaking it into a 63k transfer plus a 1k runt. 
Modern drive firmware actually sees the disk internally as 4k sectors now 
instead of 512 byte, so avoiding runt transfers and non-power-of-2 
transfers helps quite a bit with performance.

>  - Use the MIO method to talk to the Serverworks HT1000_S1 SATA controller
>    like all the other SATA controllers rather than the compat PATA
>    method.  This lets the controller see all 4 SATA ports and also
>    matches the behavior of the Linux driver.

Thanks for working on these two issues.

Scott

From owner-svn-src-head@FreeBSD.ORG  Fri Oct 17 20:09:00 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8EEA81065686;
	Fri, 17 Oct 2008 20:09:00 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7CE768FC1C;
	Fri, 17 Oct 2008 20:09:00 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9HK90ZJ096689;
	Fri, 17 Oct 2008 20:09:00 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9HK90eb096687;
	Fri, 17 Oct 2008 20:09:00 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <200810172009.m9HK90eb096687@svn.freebsd.org>
From: Xin LI 
Date: Fri, 17 Oct 2008 20:09:00 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183985 - head/lib/libkvm
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 17 Oct 2008 20:09:00 -0000

Author: delphij
Date: Fri Oct 17 20:09:00 2008
New Revision: 183985
URL: http://svn.freebsd.org/changeset/base/183985

Log:
  _kvm_malloc allocates memory through calloc() which
  returns zeroed memory, so don't redo the initialization.

Modified:
  head/lib/libkvm/kvm_minidump_amd64.c
  head/lib/libkvm/kvm_minidump_i386.c

Modified: head/lib/libkvm/kvm_minidump_amd64.c
==============================================================================
--- head/lib/libkvm/kvm_minidump_amd64.c	Fri Oct 17 19:52:35 2008	(r183984)
+++ head/lib/libkvm/kvm_minidump_amd64.c	Fri Oct 17 20:09:00 2008	(r183985)
@@ -146,7 +146,6 @@ _kvm_minidump_initvtop(kvm_t *kd)
 		return (-1);
 	}
 	kd->vmst = vmst;
-	bzero(vmst, sizeof(*vmst));
 	vmst->minidump = 1;
 	if (pread(kd->pmfd, &vmst->hdr, sizeof(vmst->hdr), 0) !=
 	    sizeof(vmst->hdr)) {

Modified: head/lib/libkvm/kvm_minidump_i386.c
==============================================================================
--- head/lib/libkvm/kvm_minidump_i386.c	Fri Oct 17 19:52:35 2008	(r183984)
+++ head/lib/libkvm/kvm_minidump_i386.c	Fri Oct 17 20:09:00 2008	(r183985)
@@ -148,7 +148,6 @@ _kvm_minidump_initvtop(kvm_t *kd)
 		return (-1);
 	}
 	kd->vmst = vmst;
-	bzero(vmst, sizeof(*vmst));
 	vmst->minidump = 1;
 	if (pread(kd->pmfd, &vmst->hdr, sizeof(vmst->hdr), 0) !=
 	    sizeof(vmst->hdr)) {

From owner-svn-src-head@FreeBSD.ORG  Fri Oct 17 20:11:28 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9F5631065691;
	Fri, 17 Oct 2008 20:11:28 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8DE6F8FC1A;
	Fri, 17 Oct 2008 20:11:28 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9HKBSlC096776;
	Fri, 17 Oct 2008 20:11:28 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9HKBSs7096775;
	Fri, 17 Oct 2008 20:11:28 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <200810172011.m9HKBSs7096775@svn.freebsd.org>
From: Xin LI 
Date: Fri, 17 Oct 2008 20:11:28 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183986 - head/lib/libkvm
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 17 Oct 2008 20:11:28 -0000

Author: delphij
Date: Fri Oct 17 20:11:28 2008
New Revision: 183986
URL: http://svn.freebsd.org/changeset/base/183986

Log:
  Reduce code duplication: use calloc() intead of malloc()
  and memset afterward.

Modified:
  head/lib/libkvm/kvm.c

Modified: head/lib/libkvm/kvm.c
==============================================================================
--- head/lib/libkvm/kvm.c	Fri Oct 17 20:09:00 2008	(r183985)
+++ head/lib/libkvm/kvm.c	Fri Oct 17 20:11:28 2008	(r183986)
@@ -244,11 +244,10 @@ kvm_openfiles(uf, mf, sf, flag, errout)
 {
 	kvm_t *kd;
 
-	if ((kd = malloc(sizeof(*kd))) == NULL) {
+	if ((kd = calloc(1, sizeof(*kd))) == NULL) {
 		(void)strlcpy(errout, strerror(errno), _POSIX2_LINE_MAX);
 		return (0);
 	}
-	memset(kd, 0, sizeof(*kd));
 	kd->program = 0;
 	return (_kvm_open(kd, uf, mf, flag, errout));
 }
@@ -263,13 +262,12 @@ kvm_open(uf, mf, sf, flag, errstr)
 {
 	kvm_t *kd;
 
-	if ((kd = malloc(sizeof(*kd))) == NULL) {
+	if ((kd = calloc(1, sizeof(*kd))) == NULL) {
 		if (errstr != NULL)
 			(void)fprintf(stderr, "%s: %s\n",
 				      errstr, strerror(errno));
 		return (0);
 	}
-	memset(kd, 0, sizeof(*kd));
 	kd->program = errstr;
 	return (_kvm_open(kd, uf, mf, flag, NULL));
 }

From owner-svn-src-head@FreeBSD.ORG  Fri Oct 17 21:11:09 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7C83D106568C;
	Fri, 17 Oct 2008 21:11:09 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 6AE5E8FC1E;
	Fri, 17 Oct 2008 21:11:09 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9HLB9Jp097898;
	Fri, 17 Oct 2008 21:11:09 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9HLB9A7097897;
	Fri, 17 Oct 2008 21:11:09 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <200810172111.m9HLB9A7097897@svn.freebsd.org>
From: Xin LI 
Date: Fri, 17 Oct 2008 21:11:09 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183987 - head/usr.sbin/setfib
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 17 Oct 2008 21:11:09 -0000

Author: delphij
Date: Fri Oct 17 21:11:09 2008
New Revision: 183987
URL: http://svn.freebsd.org/changeset/base/183987

Log:
   - Use static for usage()
   - Include necessary header files.
  
  setfib(1) should pass WARNS=6 with this changes.

Modified:
  head/usr.sbin/setfib/setfib.c

Modified: head/usr.sbin/setfib/setfib.c
==============================================================================
--- head/usr.sbin/setfib/setfib.c	Fri Oct 17 20:11:28 2008	(r183986)
+++ head/usr.sbin/setfib/setfib.c	Fri Oct 17 21:11:09 2008	(r183987)
@@ -33,15 +33,17 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-
+#include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 
-void usage(void);
+static void usage(void);
 
 int
 main(int argc, char *argv[])
@@ -93,7 +95,7 @@ main(int argc, char *argv[])
 	err(errno == ENOENT ? 127 : 126, "%s", *argv);
 }
 
-void
+static void
 usage(void)
 {
 

From owner-svn-src-head@FreeBSD.ORG  Fri Oct 17 21:14:51 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 238291065688;
	Fri, 17 Oct 2008 21:14:51 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 11D518FC12;
	Fri, 17 Oct 2008 21:14:51 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9HLEodk098058;
	Fri, 17 Oct 2008 21:14:50 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9HLEoE2098056;
	Fri, 17 Oct 2008 21:14:50 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <200810172114.m9HLEoE2098056@svn.freebsd.org>
From: Xin LI 
Date: Fri, 17 Oct 2008 21:14:50 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183988 - head/usr.bin/netstat
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 17 Oct 2008 21:14:51 -0000

Author: delphij
Date: Fri Oct 17 21:14:50 2008
New Revision: 183988
URL: http://svn.freebsd.org/changeset/base/183988

Log:
  Use strlcpy() when we mean it.

Modified:
  head/usr.bin/netstat/inet.c
  head/usr.bin/netstat/route.c

Modified: head/usr.bin/netstat/inet.c
==============================================================================
--- head/usr.bin/netstat/inet.c	Fri Oct 17 21:11:09 2008	(r183987)
+++ head/usr.bin/netstat/inet.c	Fri Oct 17 21:14:50 2008	(r183988)
@@ -1145,8 +1145,7 @@ inetname(struct in_addr *inp)
 	if (inp->s_addr == INADDR_ANY)
 		strcpy(line, "*");
 	else if (cp) {
-		strncpy(line, cp, sizeof(line) - 1);
-		line[sizeof(line) - 1] = '\0';
+		strlcpy(line, cp, sizeof(line));
 	} else {
 		inp->s_addr = ntohl(inp->s_addr);
 #define	C(x)	((u_int)((x) & 0xff))

Modified: head/usr.bin/netstat/route.c
==============================================================================
--- head/usr.bin/netstat/route.c	Fri Oct 17 21:11:09 2008	(r183987)
+++ head/usr.bin/netstat/route.c	Fri Oct 17 21:14:50 2008	(r183988)
@@ -836,8 +836,7 @@ routename(in_addr_t in)
 		}
 	}
 	if (cp) {
-		strncpy(line, cp, sizeof(line) - 1);
-		line[sizeof(line) - 1] = '\0';
+		strlcpy(line, cp, sizeof(line));
 	} else {
 #define	C(x)	((x) & 0xff)
 		in = ntohl(in);
@@ -902,8 +901,7 @@ netname(in_addr_t in, u_long mask)
 		}
 	}
 	if (cp != NULL) {
-		strncpy(line, cp, sizeof(line) - 1);
-		line[sizeof(line) - 1] = '\0';
+		strlcpy(line, cp, sizeof(line));
 	} else {
 		inet_ntop(AF_INET, &in, line, sizeof(line) - 1);
 	}

From owner-svn-src-head@FreeBSD.ORG  Fri Oct 17 21:21:14 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D8E111065678;
	Fri, 17 Oct 2008 21:21:14 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C74AB8FC0C;
	Fri, 17 Oct 2008 21:21:14 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9HLLEbE098196;
	Fri, 17 Oct 2008 21:21:14 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9HLLETA098194;
	Fri, 17 Oct 2008 21:21:14 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <200810172121.m9HLLETA098194@svn.freebsd.org>
From: Xin LI 
Date: Fri, 17 Oct 2008 21:21:14 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183989 - head/lib/libutil
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 17 Oct 2008 21:21:15 -0000

Author: delphij
Date: Fri Oct 17 21:21:14 2008
New Revision: 183989
URL: http://svn.freebsd.org/changeset/base/183989

Log:
  Use strlcpy() when we mean it.

Modified:
  head/lib/libutil/login_times.c
  head/lib/libutil/logwtmp.c
  head/lib/libutil/realhostname.c

Modified: head/lib/libutil/login_times.c
==============================================================================
--- head/lib/libutil/login_times.c	Fri Oct 17 21:14:50 2008	(r183988)
+++ head/lib/libutil/login_times.c	Fri Oct 17 21:21:14 2008	(r183989)
@@ -72,8 +72,7 @@ parse_lt(const char * str)
 	char		buf[64];
 
 	/* Make local copy and force lowercase to simplify parsing */
-	p = strncpy(buf, str, sizeof buf);
-	buf[sizeof buf - 1] = '\0';
+	p = strlcpy(buf, str, sizeof buf);
 	for (i = 0; buf[i]; i++)
 	    buf[i] = (char)tolower(buf[i]);
 

Modified: head/lib/libutil/logwtmp.c
==============================================================================
--- head/lib/libutil/logwtmp.c	Fri Oct 17 21:14:50 2008	(r183988)
+++ head/lib/libutil/logwtmp.c	Fri Oct 17 21:21:14 2008	(r183989)
@@ -59,8 +59,7 @@ logwtmp(const char *line, const char *na
 	char   fullhost[MAXHOSTNAMELEN];
 	int fd;
 	
-	strncpy(fullhost, host, sizeof(fullhost) - 1);	
-	fullhost[sizeof(fullhost) - 1] = '\0';
+	strlcpy(fullhost, host, sizeof(fullhost));	
 	trimdomain(fullhost, UT_HOSTSIZE);
 	host = fullhost;
 

Modified: head/lib/libutil/realhostname.c
==============================================================================
--- head/lib/libutil/realhostname.c	Fri Oct 17 21:14:50 2008	(r183988)
+++ head/lib/libutil/realhostname.c	Fri Oct 17 21:21:14 2008	(r183989)
@@ -61,8 +61,7 @@ realhostname(char *host, size_t hsize, c
 		if (strlen(trimmed) <= hsize) {
 			char lookup[MAXHOSTNAMELEN];
 
-			strncpy(lookup, hp->h_name, sizeof(lookup) - 1);
-			lookup[sizeof(lookup) - 1] = '\0';
+			strlcpy(lookup, hp->h_name, sizeof(lookup));
 			hp = gethostbyname(lookup);
 			if (hp == NULL)
 				result = HOSTNAME_INVALIDNAME;

From owner-svn-src-head@FreeBSD.ORG  Fri Oct 17 21:29:06 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2CDC91065698;
	Fri, 17 Oct 2008 21:29:06 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 1B63F8FC13;
	Fri, 17 Oct 2008 21:29:06 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9HLT6GO098366;
	Fri, 17 Oct 2008 21:29:06 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9HLT5BT098365;
	Fri, 17 Oct 2008 21:29:05 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <200810172129.m9HLT5BT098365@svn.freebsd.org>
From: Xin LI 
Date: Fri, 17 Oct 2008 21:29:05 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r183990 - head/lib/libc/string
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 17 Oct 2008 21:29:06 -0000

Author: delphij
Date: Fri Oct 17 21:29:05 2008
New Revision: 183990
URL: http://svn.freebsd.org/changeset/base/183990

Log:
  Use strlcpy() in !localized case to avoid the -1's.

Modified:
  head/lib/libc/string/strxfrm.c

Modified: head/lib/libc/string/strxfrm.c
==============================================================================
--- head/lib/libc/string/strxfrm.c	Fri Oct 17 21:21:14 2008	(r183989)
+++ head/lib/libc/string/strxfrm.c	Fri Oct 17 21:29:05 2008	(r183990)
@@ -51,8 +51,7 @@ strxfrm(char * __restrict dest, const ch
 			if (slen < len)
 				strcpy(dest, src);
 			else {
-				strncpy(dest, src, len - 1);
-				dest[len - 1] = '\0';
+				strlcpy(dest, src, len);
 			}
 		}
 		return slen;

From owner-svn-src-head@FreeBSD.ORG  Fri Oct 17 22:00:07 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5D7EA106568A;
	Fri, 17 Oct 2008 22:00:07 +0000 (UTC)
	(envelope-from bzeeb-lists@lists.zabbadoz.net)
Received: from mail.cksoft.de (mail.cksoft.de [62.111.66.27])
	by mx1.freebsd.org (Postfix) with ESMTP id 0B00A8FC15;
	Fri, 17 Oct 2008 22:00:06 +0000 (UTC)
	(envelope-from bzeeb-lists@lists.zabbadoz.net)
Received: from localhost (amavis.str.cksoft.de [192.168.74.71])
	by mail.cksoft.de (Postfix) with ESMTP id 581C941C7A8;
	Sat, 18 Oct 2008 00:00:05 +0200 (CEST)
X-Virus-Scanned: amavisd-new at cksoft.de
Received: from mail.cksoft.de ([62.111.66.27])
	by localhost (amavis.str.cksoft.de [192.168.74.71]) (amavisd-new,
	port 10024)
	with ESMTP id 8JgDGdOGns-G; Sat, 18 Oct 2008 00:00:05 +0200 (CEST)
Received: by mail.cksoft.de (Postfix, from userid 66)
	id 0955641C7A7; Sat, 18 Oct 2008 00:00:05 +0200 (CEST)
Received: from maildrop.int.zabbadoz.net (maildrop.int.zabbadoz.net
	[10.111.66.10])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mail.int.zabbadoz.net (Postfix) with ESMTP id D574A44487F;
	Fri, 17 Oct 2008 21:55:55 +0000 (UTC)
Date: Fri, 17 Oct 2008 21:55:55 +0000 (UTC)
From: "Bjoern A. Zeeb" 
X-X-Sender: bz@maildrop.int.zabbadoz.net
To: Ed Schouten 
In-Reply-To: <200810151658.m9FGwaYZ038854@svn.freebsd.org>
Message-ID: <20081017215522.O2978@maildrop.int.zabbadoz.net>
References: <200810151658.m9FGwaYZ038854@svn.freebsd.org>
X-OpenPGP-Key: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r183922 - in head: share/man/man4 sys/kern sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Fri, 17 Oct 2008 22:00:07 -0000

On Wed, 15 Oct 2008, Ed Schouten wrote:

> Author: ed
> Date: Wed Oct 15 16:58:35 2008
> New Revision: 183922
> URL: http://svn.freebsd.org/changeset/base/183922
>
> Log:
>  - Change the ddb(4) commands to be more useful (by thompsa@):
>
> Modified:
>  head/share/man/man4/ddb.4
>
> Modified: head/share/man/man4/ddb.4
> ==============================================================================
> --- head/share/man/man4/ddb.4	Wed Oct 15 15:54:33 2008	(r183921)
> +++ head/share/man/man4/ddb.4	Wed Oct 15 16:58:35 2008	(r183922)
> @@ -540,6 +540,13 @@ modifier will alter the display to show
> addresses for the process and not show other information.
> .\"
> .Pp
> +.It Ic show Cm all ttys
> +Show all TTY's within the system.
> +Output is similar to
> +.Xr pstat 8 ,
> +but also includes the address of the TTY structure.
> +.\"
> +.Pp
> .It Ic show Cm allchains
> Show the same information like "show lockchain" does, but
> for every thread in the system.
> @@ -963,10 +970,8 @@ Backtrace.
> .El
> .\"
> .Pp
> -.It Ic show Cm ttys
> -Show all TTY's within the system.
> -Output is similar to
> -.Xr pstat 8 .
> +.It Ic show Cm tty Ar addr
> +Display the contents of a TTY structure in a readable form.
> .\"
> .Pp
> .It Ic show Cm turnstile Ar addr


You should bump the date in there.

-- 
Bjoern A. Zeeb              Stop bit received. Insert coin for new game.

From owner-svn-src-head@FreeBSD.ORG  Sat Oct 18 06:23:08 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B02951065686;
	Sat, 18 Oct 2008 06:23:08 +0000 (UTC) (envelope-from ed@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9E1048FC12;
	Sat, 18 Oct 2008 06:23:08 +0000 (UTC) (envelope-from ed@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9I6N8DL008931;
	Sat, 18 Oct 2008 06:23:08 GMT (envelope-from ed@svn.freebsd.org)
Received: (from ed@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9I6N8Wn008930;
	Sat, 18 Oct 2008 06:23:08 GMT (envelope-from ed@svn.freebsd.org)
Message-Id: <200810180623.m9I6N8Wn008930@svn.freebsd.org>
From: Ed Schouten 
Date: Sat, 18 Oct 2008 06:23:08 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r184018 - head/share/man/man4
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 18 Oct 2008 06:23:08 -0000

Author: ed
Date: Sat Oct 18 06:23:08 2008
New Revision: 184018
URL: http://svn.freebsd.org/changeset/base/184018

Log:
  Increase the date in the manual page, which should have been done in r183922.
  
  In r183922 I introduced a new DDB command, documented it, but forgot to
  bump the date in the manual page.
  
  Pointed out by:	bz

Modified:
  head/share/man/man4/ddb.4

Modified: head/share/man/man4/ddb.4
==============================================================================
--- head/share/man/man4/ddb.4	Sat Oct 18 06:20:16 2008	(r184017)
+++ head/share/man/man4/ddb.4	Sat Oct 18 06:23:08 2008	(r184018)
@@ -60,7 +60,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 4, 2008
+.Dd October 18, 2008
 .Dt DDB 4
 .Os
 .Sh NAME

From owner-svn-src-head@FreeBSD.ORG  Sat Oct 18 06:23:31 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 435B91065690;
	Sat, 18 Oct 2008 06:23:31 +0000 (UTC) (envelope-from ed@hoeg.nl)
Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:7b8:3fb::211])
	by mx1.freebsd.org (Postfix) with ESMTP id 05EE08FC0C;
	Sat, 18 Oct 2008 06:23:30 +0000 (UTC) (envelope-from ed@hoeg.nl)
Received: by palm.hoeg.nl (Postfix, from userid 1000)
	id 6EB971CCC4; Sat, 18 Oct 2008 08:23:29 +0200 (CEST)
Date: Sat, 18 Oct 2008 08:23:29 +0200
From: Ed Schouten 
To: "Bjoern A. Zeeb" 
Message-ID: <20081018062329.GY16837@hoeg.nl>
References: <200810151658.m9FGwaYZ038854@svn.freebsd.org>
	<20081017215522.O2978@maildrop.int.zabbadoz.net>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="fwVzdwcpG0LlK9IO"
Content-Disposition: inline
In-Reply-To: <20081017215522.O2978@maildrop.int.zabbadoz.net>
User-Agent: Mutt/1.5.18 (2008-05-17)
Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org,
	src-committers@freebsd.org
Subject: Re: svn commit: r183922 - in head: share/man/man4 sys/kern sys/sys
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 18 Oct 2008 06:23:31 -0000


--fwVzdwcpG0LlK9IO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

* Bjoern A. Zeeb  wrote:
> On Wed, 15 Oct 2008, Ed Schouten wrote:
>
>> Author: ed
>> Date: Wed Oct 15 16:58:35 2008
>> New Revision: 183922
>> URL: http://svn.freebsd.org/changeset/base/183922
>>
>> Log:
>>  - Change the ddb(4) commands to be more useful (by thompsa@):
>>
> You should bump the date in there.

Done. Thanks!

--=20
 Ed Schouten 
 WWW: http://80386.nl/

--fwVzdwcpG0LlK9IO
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (FreeBSD)

iEYEARECAAYFAkj5gOEACgkQ52SDGA2eCwWnIQCffZb8Era43z8sclElr4Dw/chF
Q0UAn1ZizRKtWz0u9mXQ1k3GiJ1D3scB
=cLSI
-----END PGP SIGNATURE-----

--fwVzdwcpG0LlK9IO--

From owner-svn-src-head@FreeBSD.ORG  Sat Oct 18 13:39:23 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4CB4C1065686;
	Sat, 18 Oct 2008 13:39:23 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3BA328FC0C;
	Sat, 18 Oct 2008 13:39:23 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9IDdN0f018120;
	Sat, 18 Oct 2008 13:39:23 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9IDdNeQ018119;
	Sat, 18 Oct 2008 13:39:23 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <200810181339.m9IDdNeQ018119@svn.freebsd.org>
From: Konstantin Belousov 
Date: Sat, 18 Oct 2008 13:39:23 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r184026 - head/sys/amd64/linux32
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 18 Oct 2008 13:39:23 -0000

Author: kib
Date: Sat Oct 18 13:39:22 2008
New Revision: 184026
URL: http://svn.freebsd.org/changeset/base/184026

Log:
  Set PCB_32BIT and clear PCB_GS32BIT for linux32 binaries.
  
  Tested by:	dchagin
  MFC after:	3 days

Modified:
  head/sys/amd64/linux32/linux32_sysvec.c

Modified: head/sys/amd64/linux32/linux32_sysvec.c
==============================================================================
--- head/sys/amd64/linux32/linux32_sysvec.c	Sat Oct 18 07:20:45 2008	(r184025)
+++ head/sys/amd64/linux32/linux32_sysvec.c	Sat Oct 18 13:39:22 2008	(r184026)
@@ -843,7 +843,8 @@ exec_linux_setregs(td, entry, stack, ps_
 	fpstate_drop(td);
 
 	/* Return via doreti so that we can change to a different %cs */
-	pcb->pcb_flags |= PCB_FULLCTX;
+	pcb->pcb_flags |= PCB_FULLCTX | PCB_32BIT;
+	pcb->pcb_flags &= ~PCB_GS32BIT;
 	td->td_retval[1] = 0;
 }
 

From owner-svn-src-head@FreeBSD.ORG  Sat Oct 18 15:53:32 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1BA181065686;
	Sat, 18 Oct 2008 15:53:32 +0000 (UTC) (envelope-from rrs@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0A8838FC15;
	Sat, 18 Oct 2008 15:53:32 +0000 (UTC) (envelope-from rrs@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9IFrVtD020444;
	Sat, 18 Oct 2008 15:53:31 GMT (envelope-from rrs@svn.freebsd.org)
Received: (from rrs@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9IFrVi9020443;
	Sat, 18 Oct 2008 15:53:31 GMT (envelope-from rrs@svn.freebsd.org)
Message-Id: <200810181553.m9IFrVi9020443@svn.freebsd.org>
From: Randall Stewart 
Date: Sat, 18 Oct 2008 15:53:31 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r184027 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 18 Oct 2008 15:53:32 -0000

Author: rrs
Date: Sat Oct 18 15:53:31 2008
New Revision: 184027
URL: http://svn.freebsd.org/changeset/base/184027

Log:
  Reported by Yehuda Weinraub (yehudasa@gamil.com) - CRC32C algorithm
  uses incorrect init_bytes value. It SHOULD have the number
  of bytes to get to a 4 byte boundary.
  
  PR:	128134
  MFC after:	4 weeks

Modified:
  head/sys/netinet/sctp_crc32.c

Modified: head/sys/netinet/sctp_crc32.c
==============================================================================
--- head/sys/netinet/sctp_crc32.c	Sat Oct 18 13:39:22 2008	(r184026)
+++ head/sys/netinet/sctp_crc32.c	Sat Oct 18 15:53:31 2008	(r184027)
@@ -583,13 +583,13 @@ update_crc32(uint32_t crc32c,
     unsigned char *buffer,
     unsigned int length)
 {
-	uint32_t offset;
+	uint32_t to_even_word;
 
 	if (length == 0) {
 		return (crc32c);
 	}
-	offset = ((uintptr_t) buffer) & 0x3;
-	return (sctp_crc32c_sb8_64_bit(crc32c, buffer, length, offset));
+	to_even_word = (4 - (((uintptr_t) buffer) & 0x3));
+	return (sctp_crc32c_sb8_64_bit(crc32c, buffer, length, to_even_word));
 }
 
 uint32_t sctp_crc_c[256] = {

From owner-svn-src-head@FreeBSD.ORG  Sat Oct 18 15:54:25 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 77C2F1065688;
	Sat, 18 Oct 2008 15:54:25 +0000 (UTC) (envelope-from rrs@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 669058FC1A;
	Sat, 18 Oct 2008 15:54:25 +0000 (UTC) (envelope-from rrs@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9IFsPZB020498;
	Sat, 18 Oct 2008 15:54:25 GMT (envelope-from rrs@svn.freebsd.org)
Received: (from rrs@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9IFsPoI020497;
	Sat, 18 Oct 2008 15:54:25 GMT (envelope-from rrs@svn.freebsd.org)
Message-Id: <200810181554.m9IFsPoI020497@svn.freebsd.org>
From: Randall Stewart 
Date: Sat, 18 Oct 2008 15:54:25 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r184028 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 18 Oct 2008 15:54:25 -0000

Author: rrs
Date: Sat Oct 18 15:54:25 2008
New Revision: 184028
URL: http://svn.freebsd.org/changeset/base/184028

Log:
  - Adapt layer indication was always being given (it should only
    be given when the user has enabled it). (Michael Tuexen)
  - Sack Immediately was not being set properly on the actual chunk, it
    was only put in the rcvd_flags which is incorrect. (Michael Tuexen)
  - added an ifndef userspace to one of the already present macro's for
    inet (Brad Penoff)
  Obtained from:	Michael Tuexen and Brad Penoff
  MFC after:	4 weeks

Modified:
  head/sys/netinet/sctp_output.c

Modified: head/sys/netinet/sctp_output.c
==============================================================================
--- head/sys/netinet/sctp_output.c	Sat Oct 18 15:53:31 2008	(r184027)
+++ head/sys/netinet/sctp_output.c	Sat Oct 18 15:54:25 2008	(r184028)
@@ -4096,6 +4096,7 @@ sctp_send_initiate(struct sctp_inpcb *in
 	struct sctp_nets *net;
 	struct sctp_init_msg *initm;
 	struct sctp_supported_addr_param *sup_addr;
+	struct sctp_adaptation_layer_indication *ali;
 	struct sctp_ecn_supported_param *ecn;
 	struct sctp_prsctp_supported_param *prsctp;
 	struct sctp_ecn_nonce_supported_param *ecn_nonce;
@@ -4193,21 +4194,13 @@ sctp_send_initiate(struct sctp_inpcb *in
 #endif
 	SCTP_BUF_LEN(m) += sizeof(*sup_addr) + sizeof(uint16_t);
 
-	if (inp->sctp_ep.adaptation_layer_indicator) {
-		struct sctp_adaptation_layer_indication *ali;
-
-		ali = (struct sctp_adaptation_layer_indication *)(
-		    (caddr_t)sup_addr + sizeof(*sup_addr) + sizeof(uint16_t));
-		ali->ph.param_type = htons(SCTP_ULP_ADAPTATION);
-		ali->ph.param_length = htons(sizeof(*ali));
-		ali->indication = ntohl(inp->sctp_ep.adaptation_layer_indicator);
-		SCTP_BUF_LEN(m) += sizeof(*ali);
-		ecn = (struct sctp_ecn_supported_param *)((caddr_t)ali +
-		    sizeof(*ali));
-	} else {
-		ecn = (struct sctp_ecn_supported_param *)((caddr_t)sup_addr +
-		    sizeof(*sup_addr) + sizeof(uint16_t));
-	}
+	/* adaptation layer indication parameter */
+	ali = (struct sctp_adaptation_layer_indication *)((caddr_t)sup_addr + sizeof(*sup_addr) + sizeof(uint16_t));
+	ali->ph.param_type = htons(SCTP_ULP_ADAPTATION);
+	ali->ph.param_length = htons(sizeof(*ali));
+	ali->indication = ntohl(inp->sctp_ep.adaptation_layer_indicator);
+	SCTP_BUF_LEN(m) += sizeof(*ali);
+	ecn = (struct sctp_ecn_supported_param *)((caddr_t)ali + sizeof(*ali));
 
 	/* now any cookie time extensions */
 	if (stcb->asoc.cookie_preserve_req) {
@@ -4889,6 +4882,7 @@ sctp_send_initiate_ack(struct sctp_inpcb
 	struct sctp_association *asoc;
 	struct mbuf *m, *m_at, *m_tmp, *m_cookie, *op_err, *mp_last;
 	struct sctp_init_msg *initackm_out;
+	struct sctp_adaptation_layer_indication *ali;
 	struct sctp_ecn_supported_param *ecn;
 	struct sctp_prsctp_supported_param *prsctp;
 	struct sctp_ecn_nonce_supported_param *ecn_nonce;
@@ -5319,23 +5313,14 @@ do_a_abort:
 	/* tell him his limt. */
 	initackm_out->msg.init.num_inbound_streams =
 	    htons(inp->sctp_ep.max_open_streams_intome);
-	/* setup the ECN pointer */
 
-	if (inp->sctp_ep.adaptation_layer_indicator) {
-		struct sctp_adaptation_layer_indication *ali;
-
-		ali = (struct sctp_adaptation_layer_indication *)(
-		    (caddr_t)initackm_out + sizeof(*initackm_out));
-		ali->ph.param_type = htons(SCTP_ULP_ADAPTATION);
-		ali->ph.param_length = htons(sizeof(*ali));
-		ali->indication = ntohl(inp->sctp_ep.adaptation_layer_indicator);
-		SCTP_BUF_LEN(m) += sizeof(*ali);
-		ecn = (struct sctp_ecn_supported_param *)((caddr_t)ali +
-		    sizeof(*ali));
-	} else {
-		ecn = (struct sctp_ecn_supported_param *)(
-		    (caddr_t)initackm_out + sizeof(*initackm_out));
-	}
+	/* adaptation layer indication parameter */
+	ali = (struct sctp_adaptation_layer_indication *)((caddr_t)initackm_out + sizeof(*initackm_out));
+	ali->ph.param_type = htons(SCTP_ULP_ADAPTATION);
+	ali->ph.param_length = htons(sizeof(*ali));
+	ali->indication = ntohl(inp->sctp_ep.adaptation_layer_indicator);
+	SCTP_BUF_LEN(m) += sizeof(*ali);
+	ecn = (struct sctp_ecn_supported_param *)((caddr_t)ali + sizeof(*ali));
 
 	/* ECN parameter */
 	if (SCTP_BASE_SYSCTL(sctp_ecn_enable) == 1) {
@@ -6816,6 +6801,9 @@ re_look:
 	if (sp->sinfo_flags & SCTP_UNORDERED) {
 		rcv_flags |= SCTP_DATA_UNORDERED;
 	}
+	if (SCTP_BASE_SYSCTL(sctp_enable_sack_immediately) && ((sp->sinfo_flags & SCTP_EOF) == SCTP_EOF)) {
+		rcv_flags |= SCTP_DATA_SACK_IMMEDIATELY;
+	}
 	/* clear out the chunk before setting up */
 	memset(chk, 0, sizeof(*chk));
 	chk->rec.data.rcv_flags = rcv_flags;
@@ -8062,6 +8050,13 @@ again_one_more_time:
 					    chk->send_size, mtu);
 					chk->flags |= CHUNK_FLAGS_FRAGMENT_OK;
 				}
+				if (SCTP_BASE_SYSCTL(sctp_enable_sack_immediately) &&
+				    ((asoc->state & SCTP_STATE_SHUTDOWN_PENDING) == SCTP_STATE_SHUTDOWN_PENDING)) {
+					struct sctp_data_chunk *dchkh;
+
+					dchkh = mtod(chk->data, struct sctp_data_chunk *);
+					dchkh->ch.chunk_flags |= SCTP_DATA_SACK_IMMEDIATELY;
+				}
 				if (((chk->send_size <= mtu) && (chk->send_size <= r_mtu)) ||
 				    ((chk->flags & CHUNK_FLAGS_FRAGMENT_OK) && (chk->send_size <= asoc->peers_rwnd))) {
 					/* ok we will add this one */
@@ -11737,7 +11732,7 @@ sctp_sosend(struct socket *so,
 		}
 	}
 	addr_to_use = addr;
-#ifdef INET6
+#if defined(INET6)  && !defined(__Userspace__)	/* TODO port in6_sin6_2_sin */
 	if ((addr) && (addr->sa_family == AF_INET6)) {
 		struct sockaddr_in6 *sin6;
 

From owner-svn-src-head@FreeBSD.ORG  Sat Oct 18 15:55:16 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5AC241065686;
	Sat, 18 Oct 2008 15:55:16 +0000 (UTC) (envelope-from rrs@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 49DF08FC1D;
	Sat, 18 Oct 2008 15:55:16 +0000 (UTC) (envelope-from rrs@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9IFtG8e020566;
	Sat, 18 Oct 2008 15:55:16 GMT (envelope-from rrs@svn.freebsd.org)
Received: (from rrs@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9IFtGKG020564;
	Sat, 18 Oct 2008 15:55:16 GMT (envelope-from rrs@svn.freebsd.org)
Message-Id: <200810181555.m9IFtGKG020564@svn.freebsd.org>
From: Randall Stewart 
Date: Sat, 18 Oct 2008 15:55:16 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r184029 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 18 Oct 2008 15:55:16 -0000

Author: rrs
Date: Sat Oct 18 15:55:15 2008
New Revision: 184029
URL: http://svn.freebsd.org/changeset/base/184029

Log:
  - Peers rwnd is now available for the MIB.
  Obtained from:	Michael Tuexen

Modified:
  head/sys/netinet/sctp_sysctl.c
  head/sys/netinet/sctp_uio.h

Modified: head/sys/netinet/sctp_sysctl.c
==============================================================================
--- head/sys/netinet/sctp_sysctl.c	Sat Oct 18 15:54:25 2008	(r184028)
+++ head/sys/netinet/sctp_sysctl.c	Sat Oct 18 15:55:15 2008	(r184029)
@@ -426,6 +426,7 @@ sctp_assoclist(SYSCTL_HANDLER_ARGS)
 			xstcb.cumulative_tsn = stcb->asoc.last_acked_seq;
 			xstcb.cumulative_tsn_ack = stcb->asoc.cumulative_tsn;
 			xstcb.mtu = stcb->asoc.smallest_mtu;
+			xstcb.peers_rwnd = stcb->asoc.peers_rwnd;
 			xstcb.refcnt = stcb->asoc.refcnt;
 			SCTP_INP_RUNLOCK(inp);
 			SCTP_INP_INFO_RUNLOCK();

Modified: head/sys/netinet/sctp_uio.h
==============================================================================
--- head/sys/netinet/sctp_uio.h	Sat Oct 18 15:54:25 2008	(r184028)
+++ head/sys/netinet/sctp_uio.h	Sat Oct 18 15:55:15 2008	(r184029)
@@ -989,6 +989,7 @@ struct xsctp_tcb {
 	uint32_t cumulative_tsn;
 	uint32_t cumulative_tsn_ack;
 	uint32_t mtu;
+	uint32_t peers_rwnd;
 	uint32_t refcnt;
 	uint16_t local_port;	/* sctpAssocEntry 3   */
 	uint16_t remote_port;	/* sctpAssocEntry 4   */

From owner-svn-src-head@FreeBSD.ORG  Sat Oct 18 15:56:12 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id AE240106569D;
	Sat, 18 Oct 2008 15:56:12 +0000 (UTC) (envelope-from rrs@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9D0418FC15;
	Sat, 18 Oct 2008 15:56:12 +0000 (UTC) (envelope-from rrs@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9IFuCbR020618;
	Sat, 18 Oct 2008 15:56:12 GMT (envelope-from rrs@svn.freebsd.org)
Received: (from rrs@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9IFuCpt020617;
	Sat, 18 Oct 2008 15:56:12 GMT (envelope-from rrs@svn.freebsd.org)
Message-Id: <200810181556.m9IFuCpt020617@svn.freebsd.org>
From: Randall Stewart 
Date: Sat, 18 Oct 2008 15:56:12 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r184030 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 18 Oct 2008 15:56:12 -0000

Author: rrs
Date: Sat Oct 18 15:56:12 2008
New Revision: 184030
URL: http://svn.freebsd.org/changeset/base/184030

Log:
  New sockets (accepted) were not inheriting the proper snd/rcv buffer value.
  
  Obtained from:	 Michael Tuexen

Modified:
  head/sys/netinet/sctp_usrreq.c

Modified: head/sys/netinet/sctp_usrreq.c
==============================================================================
--- head/sys/netinet/sctp_usrreq.c	Sat Oct 18 15:55:15 2008	(r184029)
+++ head/sys/netinet/sctp_usrreq.c	Sat Oct 18 15:56:12 2008	(r184030)
@@ -517,9 +517,11 @@ sctp_attach(struct socket *so, int proto
 		SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
 		return EINVAL;
 	}
-	error = SCTP_SORESERVE(so, SCTP_BASE_SYSCTL(sctp_sendspace), SCTP_BASE_SYSCTL(sctp_recvspace));
-	if (error) {
-		return error;
+	if (so->so_snd.sb_hiwat == 0 || so->so_rcv.sb_hiwat == 0) {
+		error = SCTP_SORESERVE(so, SCTP_BASE_SYSCTL(sctp_sendspace), SCTP_BASE_SYSCTL(sctp_recvspace));
+		if (error) {
+			return error;
+		}
 	}
 	error = sctp_inpcb_alloc(so, vrf_id);
 	if (error) {

From owner-svn-src-head@FreeBSD.ORG  Sat Oct 18 15:56:53 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 494981065695;
	Sat, 18 Oct 2008 15:56:53 +0000 (UTC) (envelope-from rrs@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 386168FC17;
	Sat, 18 Oct 2008 15:56:53 +0000 (UTC) (envelope-from rrs@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9IFurBA020663;
	Sat, 18 Oct 2008 15:56:53 GMT (envelope-from rrs@svn.freebsd.org)
Received: (from rrs@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9IFurli020662;
	Sat, 18 Oct 2008 15:56:53 GMT (envelope-from rrs@svn.freebsd.org)
Message-Id: <200810181556.m9IFurli020662@svn.freebsd.org>
From: Randall Stewart 
Date: Sat, 18 Oct 2008 15:56:53 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r184031 - head/sys/netinet
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 18 Oct 2008 15:56:53 -0000

Author: rrs
Date: Sat Oct 18 15:56:52 2008
New Revision: 184031
URL: http://svn.freebsd.org/changeset/base/184031

Log:
  The flags value was not always being copied out in the recv routine like it
  should be.
  Obtained from:	Michael Tuexen

Modified:
  head/sys/netinet/sctputil.c

Modified: head/sys/netinet/sctputil.c
==============================================================================
--- head/sys/netinet/sctputil.c	Sat Oct 18 15:56:12 2008	(r184030)
+++ head/sys/netinet/sctputil.c	Sat Oct 18 15:56:52 2008	(r184031)
@@ -5896,9 +5896,10 @@ release_unlocked:
 		    (no_rcv_needed == 0))
 			sctp_user_rcvd(stcb, &freed_so_far, hold_rlock, rwnd_req);
 	}
-	if (msg_flags)
-		*msg_flags = out_flags;
 out:
+	if (msg_flags) {
+		*msg_flags = out_flags;
+	}
 	if (((out_flags & MSG_EOR) == 0) &&
 	    ((in_flags & MSG_PEEK) == 0) &&
 	    (sinfo) &&

From owner-svn-src-head@FreeBSD.ORG  Sat Oct 18 16:17:04 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 84A751065692;
	Sat, 18 Oct 2008 16:17:04 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7172A8FC17;
	Sat, 18 Oct 2008 16:17:04 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9IGH4dR021097;
	Sat, 18 Oct 2008 16:17:04 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9IGH4m8021093;
	Sat, 18 Oct 2008 16:17:04 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200810181617.m9IGH4m8021093@svn.freebsd.org>
From: Alexander Motin 
Date: Sat, 18 Oct 2008 16:17:04 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r184033 - head/sys/dev/mmc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 18 Oct 2008 16:17:04 -0000

Author: mav
Date: Sat Oct 18 16:17:04 2008
New Revision: 184033
URL: http://svn.freebsd.org/changeset/base/184033

Log:
  Implement BIO_DELETE command with MMC and SD erase commands.
  
  Erase operation gives card's logic information about unused areas to help it
  implement wear-leveling with lower overhead comparing to usual writing.
  Erase is much faster then write and does not depends on data bus speed.
  Also as result of hitting in-card write logic optimizations I have measured
  up to 50% performance boost on writing undersized blocks into preerased areas.
  
  At the same time there are strict limitations on size and allignment of erase
  operations. We can erase only blocks aligned to the erase sector size and
  with size multiple of it. Different cards has different erase sector size
  which usually varies from 64KB to 4MB. SD cards actually allow to erase
  smaller blocks, but it is much more expensive as it is implemented via
  read-erase-write sequence and so not sutable for the BIO_DELETE purposes.
  
  Reviewed by:	imp@

Modified:
  head/sys/dev/mmc/mmc.c
  head/sys/dev/mmc/mmcreg.h
  head/sys/dev/mmc/mmcsd.c
  head/sys/dev/mmc/mmcvar.h

Modified: head/sys/dev/mmc/mmc.c
==============================================================================
--- head/sys/dev/mmc/mmc.c	Sat Oct 18 16:02:48 2008	(r184032)
+++ head/sys/dev/mmc/mmc.c	Sat Oct 18 16:17:04 2008	(r184033)
@@ -85,11 +85,13 @@ struct mmc_ivars {
 	uint32_t raw_csd[4];	/* Raw bits of the CSD */
 	uint32_t raw_scr[2];	/* Raw bits of the SCR */
 	uint8_t raw_ext_csd[512];	/* Raw bits of the EXT_CSD */
+	uint32_t raw_sd_status[16];	/* Raw bits of the SD_STATUS */
 	uint16_t rca;
 	enum mmc_card_mode mode;
 	struct mmc_cid cid;	/* cid decoded */
 	struct mmc_csd csd;	/* csd decoded */
 	struct mmc_scr scr;	/* scr decoded */
+	struct mmc_sd_status sd_status;	/* SD_STATUS decoded */
 	u_char read_only;	/* True when the device is read-only */
 	u_char bus_width;	/* Bus width to use */
 	u_char timing;		/* Bus timing support */
@@ -97,6 +99,7 @@ struct mmc_ivars {
 	uint32_t sec_count;	/* Card capacity in 512byte blocks */
 	uint32_t tran_speed;	/* Max speed in normal mode */
 	uint32_t hs_tran_speed;	/* Max speed in high speed mode */
+	uint32_t erase_sector;	/* Card native erase sector size */
 };
 
 #define CMD_RETRIES	3
@@ -723,9 +726,8 @@ mmc_test_bus_width(struct mmc_softc *sc)
 }
 
 static uint32_t
-mmc_get_bits(uint32_t *bits, int start, int size)
+mmc_get_bits(uint32_t *bits, int bit_len, int start, int size)
 {
-	const int bit_len = 128;
 	const int i = (bit_len / 32) - (start / 32) - 1;
 	const int shift = start & 31;
 	uint32_t retval = bits[i] >> shift;
@@ -741,14 +743,14 @@ mmc_decode_cid_sd(uint32_t *raw_cid, str
 
 	/* There's no version info, so we take it on faith */
 	memset(cid, 0, sizeof(*cid));
-	cid->mid = mmc_get_bits(raw_cid, 120, 8);
-	cid->oid = mmc_get_bits(raw_cid, 104, 16);
+	cid->mid = mmc_get_bits(raw_cid, 128, 120, 8);
+	cid->oid = mmc_get_bits(raw_cid, 128, 104, 16);
 	for (i = 0; i < 5; i++)
-		cid->pnm[i] = mmc_get_bits(raw_cid, 96 - i * 8, 8);
-	cid->prv = mmc_get_bits(raw_cid, 56, 8);
-	cid->psn = mmc_get_bits(raw_cid, 24, 32);
-	cid->mdt_year = mmc_get_bits(raw_cid, 12, 8) + 2001;
-	cid->mdt_month = mmc_get_bits(raw_cid, 8, 4);
+		cid->pnm[i] = mmc_get_bits(raw_cid, 128, 96 - i * 8, 8);
+	cid->prv = mmc_get_bits(raw_cid, 128, 56, 8);
+	cid->psn = mmc_get_bits(raw_cid, 128, 24, 32);
+	cid->mdt_year = mmc_get_bits(raw_cid, 128, 12, 8) + 2001;
+	cid->mdt_month = mmc_get_bits(raw_cid, 128, 8, 4);
 }
 
 static void
@@ -758,14 +760,14 @@ mmc_decode_cid_mmc(uint32_t *raw_cid, st
 
 	/* There's no version info, so we take it on faith */
 	memset(cid, 0, sizeof(*cid));
-	cid->mid = mmc_get_bits(raw_cid, 120, 8);
-	cid->oid = mmc_get_bits(raw_cid, 104, 8);
+	cid->mid = mmc_get_bits(raw_cid, 128, 120, 8);
+	cid->oid = mmc_get_bits(raw_cid, 128, 104, 8);
 	for (i = 0; i < 6; i++)
-		cid->pnm[i] = mmc_get_bits(raw_cid, 96 - i * 8, 8);
-	cid->prv = mmc_get_bits(raw_cid, 48, 8);
-	cid->psn = mmc_get_bits(raw_cid, 16, 32);
-	cid->mdt_month = mmc_get_bits(raw_cid, 12, 4);
-	cid->mdt_year = mmc_get_bits(raw_cid, 8, 4) + 1997;
+		cid->pnm[i] = mmc_get_bits(raw_cid, 128, 96 - i * 8, 8);
+	cid->prv = mmc_get_bits(raw_cid, 128, 48, 8);
+	cid->psn = mmc_get_bits(raw_cid, 128, 16, 32);
+	cid->mdt_month = mmc_get_bits(raw_cid, 128, 12, 4);
+	cid->mdt_year = mmc_get_bits(raw_cid, 128, 8, 4) + 1997;
 }
 
 static const int exp[8] = {
@@ -789,58 +791,58 @@ mmc_decode_csd_sd(uint32_t *raw_csd, str
 	int e;
 
 	memset(csd, 0, sizeof(*csd));
-	csd->csd_structure = v = mmc_get_bits(raw_csd, 126, 2);
+	csd->csd_structure = v = mmc_get_bits(raw_csd, 128, 126, 2);
 	if (v == 0) {
-		m = mmc_get_bits(raw_csd, 115, 4);
-		e = mmc_get_bits(raw_csd, 112, 3);
+		m = mmc_get_bits(raw_csd, 128, 115, 4);
+		e = mmc_get_bits(raw_csd, 128, 112, 3);
 		csd->tacc = exp[e] * mant[m] + 9 / 10;
-		csd->nsac = mmc_get_bits(raw_csd, 104, 8) * 100;
-		m = mmc_get_bits(raw_csd, 99, 4);
-		e = mmc_get_bits(raw_csd, 96, 3);
+		csd->nsac = mmc_get_bits(raw_csd, 128, 104, 8) * 100;
+		m = mmc_get_bits(raw_csd, 128, 99, 4);
+		e = mmc_get_bits(raw_csd, 128, 96, 3);
 		csd->tran_speed = exp[e] * 10000 * mant[m];
-		csd->ccc = mmc_get_bits(raw_csd, 84, 12);
-		csd->read_bl_len = 1 << mmc_get_bits(raw_csd, 80, 4);
-		csd->read_bl_partial = mmc_get_bits(raw_csd, 79, 1);
-		csd->write_blk_misalign = mmc_get_bits(raw_csd, 78, 1);
-		csd->read_blk_misalign = mmc_get_bits(raw_csd, 77, 1);
-		csd->dsr_imp = mmc_get_bits(raw_csd, 76, 1);
-		csd->vdd_r_curr_min = cur_min[mmc_get_bits(raw_csd, 59, 3)];
-		csd->vdd_r_curr_max = cur_max[mmc_get_bits(raw_csd, 56, 3)];
-		csd->vdd_w_curr_min = cur_min[mmc_get_bits(raw_csd, 53, 3)];
-		csd->vdd_w_curr_max = cur_max[mmc_get_bits(raw_csd, 50, 3)];
-		m = mmc_get_bits(raw_csd, 62, 12);
-		e = mmc_get_bits(raw_csd, 47, 3);
+		csd->ccc = mmc_get_bits(raw_csd, 128, 84, 12);
+		csd->read_bl_len = 1 << mmc_get_bits(raw_csd, 128, 80, 4);
+		csd->read_bl_partial = mmc_get_bits(raw_csd, 128, 79, 1);
+		csd->write_blk_misalign = mmc_get_bits(raw_csd, 128, 78, 1);
+		csd->read_blk_misalign = mmc_get_bits(raw_csd, 128, 77, 1);
+		csd->dsr_imp = mmc_get_bits(raw_csd, 128, 76, 1);
+		csd->vdd_r_curr_min = cur_min[mmc_get_bits(raw_csd, 128, 59, 3)];
+		csd->vdd_r_curr_max = cur_max[mmc_get_bits(raw_csd, 128, 56, 3)];
+		csd->vdd_w_curr_min = cur_min[mmc_get_bits(raw_csd, 128, 53, 3)];
+		csd->vdd_w_curr_max = cur_max[mmc_get_bits(raw_csd, 128, 50, 3)];
+		m = mmc_get_bits(raw_csd, 128, 62, 12);
+		e = mmc_get_bits(raw_csd, 128, 47, 3);
 		csd->capacity = ((1 + m) << (e + 2)) * csd->read_bl_len;
-		csd->erase_blk_en = mmc_get_bits(raw_csd, 46, 1);
-		csd->sector_size = mmc_get_bits(raw_csd, 39, 7);
-		csd->wp_grp_size = mmc_get_bits(raw_csd, 32, 7);
-		csd->wp_grp_enable = mmc_get_bits(raw_csd, 31, 1);
-		csd->r2w_factor = 1 << mmc_get_bits(raw_csd, 26, 3);
-		csd->write_bl_len = 1 << mmc_get_bits(raw_csd, 22, 4);
-		csd->write_bl_partial = mmc_get_bits(raw_csd, 21, 1);
+		csd->erase_blk_en = mmc_get_bits(raw_csd, 128, 46, 1);
+		csd->erase_sector = mmc_get_bits(raw_csd, 128, 39, 7) + 1;
+		csd->wp_grp_size = mmc_get_bits(raw_csd, 128, 32, 7);
+		csd->wp_grp_enable = mmc_get_bits(raw_csd, 128, 31, 1);
+		csd->r2w_factor = 1 << mmc_get_bits(raw_csd, 128, 26, 3);
+		csd->write_bl_len = 1 << mmc_get_bits(raw_csd, 128, 22, 4);
+		csd->write_bl_partial = mmc_get_bits(raw_csd, 128, 21, 1);
 	} else if (v == 1) {
-		m = mmc_get_bits(raw_csd, 115, 4);
-		e = mmc_get_bits(raw_csd, 112, 3);
+		m = mmc_get_bits(raw_csd, 128, 115, 4);
+		e = mmc_get_bits(raw_csd, 128, 112, 3);
 		csd->tacc = exp[e] * mant[m] + 9 / 10;
-		csd->nsac = mmc_get_bits(raw_csd, 104, 8) * 100;
-		m = mmc_get_bits(raw_csd, 99, 4);
-		e = mmc_get_bits(raw_csd, 96, 3);
+		csd->nsac = mmc_get_bits(raw_csd, 128, 104, 8) * 100;
+		m = mmc_get_bits(raw_csd, 128, 99, 4);
+		e = mmc_get_bits(raw_csd, 128, 96, 3);
 		csd->tran_speed = exp[e] * 10000 * mant[m];
-		csd->ccc = mmc_get_bits(raw_csd, 84, 12);
-		csd->read_bl_len = 1 << mmc_get_bits(raw_csd, 80, 4);
-		csd->read_bl_partial = mmc_get_bits(raw_csd, 79, 1);
-		csd->write_blk_misalign = mmc_get_bits(raw_csd, 78, 1);
-		csd->read_blk_misalign = mmc_get_bits(raw_csd, 77, 1);
-		csd->dsr_imp = mmc_get_bits(raw_csd, 76, 1);
-		csd->capacity = ((uint64_t)mmc_get_bits(raw_csd, 48, 22) + 1) *
+		csd->ccc = mmc_get_bits(raw_csd, 128, 84, 12);
+		csd->read_bl_len = 1 << mmc_get_bits(raw_csd, 128, 80, 4);
+		csd->read_bl_partial = mmc_get_bits(raw_csd, 128, 79, 1);
+		csd->write_blk_misalign = mmc_get_bits(raw_csd, 128, 78, 1);
+		csd->read_blk_misalign = mmc_get_bits(raw_csd, 128, 77, 1);
+		csd->dsr_imp = mmc_get_bits(raw_csd, 128, 76, 1);
+		csd->capacity = ((uint64_t)mmc_get_bits(raw_csd, 128, 48, 22) + 1) *
 		    512 * 1024;
-		csd->erase_blk_en = mmc_get_bits(raw_csd, 46, 1);
-		csd->sector_size = mmc_get_bits(raw_csd, 39, 7);
-		csd->wp_grp_size = mmc_get_bits(raw_csd, 32, 7);
-		csd->wp_grp_enable = mmc_get_bits(raw_csd, 31, 1);
-		csd->r2w_factor = 1 << mmc_get_bits(raw_csd, 26, 3);
-		csd->write_bl_len = 1 << mmc_get_bits(raw_csd, 22, 4);
-		csd->write_bl_partial = mmc_get_bits(raw_csd, 21, 1);
+		csd->erase_blk_en = mmc_get_bits(raw_csd, 128, 46, 1);
+		csd->erase_sector = mmc_get_bits(raw_csd, 128, 39, 7) + 1;
+		csd->wp_grp_size = mmc_get_bits(raw_csd, 128, 32, 7);
+		csd->wp_grp_enable = mmc_get_bits(raw_csd, 128, 31, 1);
+		csd->r2w_factor = 1 << mmc_get_bits(raw_csd, 128, 26, 3);
+		csd->write_bl_len = 1 << mmc_get_bits(raw_csd, 128, 22, 4);
+		csd->write_bl_partial = mmc_get_bits(raw_csd, 128, 21, 1);
 	} else 
 		panic("unknown SD CSD version");
 }
@@ -852,56 +854,72 @@ mmc_decode_csd_mmc(uint32_t *raw_csd, st
 	int e;
 
 	memset(csd, 0, sizeof(*csd));
-	csd->csd_structure = mmc_get_bits(raw_csd, 126, 2);
-	csd->spec_vers = mmc_get_bits(raw_csd, 122, 4);
-	m = mmc_get_bits(raw_csd, 115, 4);
-	e = mmc_get_bits(raw_csd, 112, 3);
+	csd->csd_structure = mmc_get_bits(raw_csd, 128, 126, 2);
+	csd->spec_vers = mmc_get_bits(raw_csd, 128, 122, 4);
+	m = mmc_get_bits(raw_csd, 128, 115, 4);
+	e = mmc_get_bits(raw_csd, 128, 112, 3);
 	csd->tacc = exp[e] * mant[m] + 9 / 10;
-	csd->nsac = mmc_get_bits(raw_csd, 104, 8) * 100;
-	m = mmc_get_bits(raw_csd, 99, 4);
-	e = mmc_get_bits(raw_csd, 96, 3);
+	csd->nsac = mmc_get_bits(raw_csd, 128, 104, 8) * 100;
+	m = mmc_get_bits(raw_csd, 128, 99, 4);
+	e = mmc_get_bits(raw_csd, 128, 96, 3);
 	csd->tran_speed = exp[e] * 10000 * mant[m];
-	csd->ccc = mmc_get_bits(raw_csd, 84, 12);
-	csd->read_bl_len = 1 << mmc_get_bits(raw_csd, 80, 4);
-	csd->read_bl_partial = mmc_get_bits(raw_csd, 79, 1);
-	csd->write_blk_misalign = mmc_get_bits(raw_csd, 78, 1);
-	csd->read_blk_misalign = mmc_get_bits(raw_csd, 77, 1);
-	csd->dsr_imp = mmc_get_bits(raw_csd, 76, 1);
-	csd->vdd_r_curr_min = cur_min[mmc_get_bits(raw_csd, 59, 3)];
-	csd->vdd_r_curr_max = cur_max[mmc_get_bits(raw_csd, 56, 3)];
-	csd->vdd_w_curr_min = cur_min[mmc_get_bits(raw_csd, 53, 3)];
-	csd->vdd_w_curr_max = cur_max[mmc_get_bits(raw_csd, 50, 3)];
-	m = mmc_get_bits(raw_csd, 62, 12);
-	e = mmc_get_bits(raw_csd, 47, 3);
+	csd->ccc = mmc_get_bits(raw_csd, 128, 84, 12);
+	csd->read_bl_len = 1 << mmc_get_bits(raw_csd, 128, 80, 4);
+	csd->read_bl_partial = mmc_get_bits(raw_csd, 128, 79, 1);
+	csd->write_blk_misalign = mmc_get_bits(raw_csd, 128, 78, 1);
+	csd->read_blk_misalign = mmc_get_bits(raw_csd, 128, 77, 1);
+	csd->dsr_imp = mmc_get_bits(raw_csd, 128, 76, 1);
+	csd->vdd_r_curr_min = cur_min[mmc_get_bits(raw_csd, 128, 59, 3)];
+	csd->vdd_r_curr_max = cur_max[mmc_get_bits(raw_csd, 128, 56, 3)];
+	csd->vdd_w_curr_min = cur_min[mmc_get_bits(raw_csd, 128, 53, 3)];
+	csd->vdd_w_curr_max = cur_max[mmc_get_bits(raw_csd, 128, 50, 3)];
+	m = mmc_get_bits(raw_csd, 128, 62, 12);
+	e = mmc_get_bits(raw_csd, 128, 47, 3);
 	csd->capacity = ((1 + m) << (e + 2)) * csd->read_bl_len;
-//	csd->erase_blk_en = mmc_get_bits(raw_csd, 46, 1);
-//	csd->sector_size = mmc_get_bits(raw_csd, 39, 7);
-	csd->wp_grp_size = mmc_get_bits(raw_csd, 32, 5);
-	csd->wp_grp_enable = mmc_get_bits(raw_csd, 31, 1);
-	csd->r2w_factor = 1 << mmc_get_bits(raw_csd, 26, 3);
-	csd->write_bl_len = 1 << mmc_get_bits(raw_csd, 22, 4);
-	csd->write_bl_partial = mmc_get_bits(raw_csd, 21, 1);
+	csd->erase_blk_en = 0;
+	csd->erase_sector = (mmc_get_bits(raw_csd, 128, 42, 5) + 1) *
+	    (mmc_get_bits(raw_csd, 128, 37, 5) + 1);
+	csd->wp_grp_size = mmc_get_bits(raw_csd, 128, 32, 5);
+	csd->wp_grp_enable = mmc_get_bits(raw_csd, 128, 31, 1);
+	csd->r2w_factor = 1 << mmc_get_bits(raw_csd, 128, 26, 3);
+	csd->write_bl_len = 1 << mmc_get_bits(raw_csd, 128, 22, 4);
+	csd->write_bl_partial = mmc_get_bits(raw_csd, 128, 21, 1);
 }
 
 static void
 mmc_app_decode_scr(uint32_t *raw_scr, struct mmc_scr *scr)
 {
 	unsigned int scr_struct;
-	uint32_t tmp[4];
-
-	tmp[3] = raw_scr[1];
-	tmp[2] = raw_scr[0];
 
 	memset(scr, 0, sizeof(*scr));
 
-	scr_struct = mmc_get_bits(tmp, 60, 4);
+	scr_struct = mmc_get_bits(raw_scr, 64, 60, 4);
 	if (scr_struct != 0) {
 		printf("Unrecognised SCR structure version %d\n",
 		    scr_struct);
 		return;
 	}
-	scr->sda_vsn = mmc_get_bits(tmp, 56, 4);
-	scr->bus_widths = mmc_get_bits(tmp, 48, 4);
+	scr->sda_vsn = mmc_get_bits(raw_scr, 64, 56, 4);
+	scr->bus_widths = mmc_get_bits(raw_scr, 64, 48, 4);
+}
+
+static void
+mmc_app_decode_sd_status(uint32_t *raw_sd_status,
+    struct mmc_sd_status *sd_status)
+{
+
+	memset(sd_status, 0, sizeof(*sd_status));
+
+	sd_status->bus_width = mmc_get_bits(raw_sd_status, 512, 510, 2);
+	sd_status->secured_mode = mmc_get_bits(raw_sd_status, 512, 509, 1);
+	sd_status->card_type = mmc_get_bits(raw_sd_status, 512, 480, 16);
+	sd_status->prot_area = mmc_get_bits(raw_sd_status, 512, 448, 12);
+	sd_status->speed_class = mmc_get_bits(raw_sd_status, 512, 440, 8);
+	sd_status->perf_move = mmc_get_bits(raw_sd_status, 512, 432, 8);
+	sd_status->au_size = mmc_get_bits(raw_sd_status, 512, 428, 4);
+	sd_status->erase_size = mmc_get_bits(raw_sd_status, 512, 408, 16);
+	sd_status->erase_timeout = mmc_get_bits(raw_sd_status, 512, 402, 6);
+	sd_status->erase_offset = mmc_get_bits(raw_sd_status, 512, 400, 2);
 }
 
 static int
@@ -985,6 +1003,32 @@ mmc_send_ext_csd(struct mmc_softc *sc, u
 }
 
 static int
+mmc_app_sd_status(struct mmc_softc *sc, uint16_t rca, uint32_t *rawsdstatus)
+{
+	int err, i;
+	struct mmc_command cmd;
+	struct mmc_data data;
+
+	memset(&cmd, 0, sizeof(struct mmc_command));
+	memset(&data, 0, sizeof(struct mmc_data));
+
+	memset(rawsdstatus, 0, 64);
+	cmd.opcode = ACMD_SD_STATUS;
+	cmd.flags = MMC_RSP_R1 | MMC_CMD_ADTC;
+	cmd.arg = 0;
+	cmd.data = &data;
+
+	data.data = rawsdstatus;
+	data.len = 64;
+	data.flags = MMC_DATA_READ;
+
+	err = mmc_wait_for_app_cmd(sc, rca, &cmd, CMD_RETRIES);
+	for (i = 0; i < 16; i++)
+	    rawsdstatus[i] = be32toh(rawsdstatus[i]);
+	return (err);
+}
+
+static int
 mmc_set_relative_addr(struct mmc_softc *sc, uint16_t resp)
 {
 	struct mmc_command cmd;
@@ -1050,6 +1094,8 @@ mmc_discover_cards(struct mmc_softc *sc)
 			if (ivar->csd.csd_structure > 0)
 				ivar->high_cap = 1;
 			ivar->tran_speed = ivar->csd.tran_speed;
+			ivar->erase_sector = ivar->csd.erase_sector * 
+			    ivar->csd.write_bl_len / MMC_SECTOR_SIZE;
 			/* Get card SCR. Card must be selected to fetch it. */
 			mmc_select_card(sc, ivar->rca);
 			mmc_app_send_scr(sc, ivar->rca, ivar->raw_scr);
@@ -1063,6 +1109,13 @@ mmc_discover_cards(struct mmc_softc *sc)
 					ivar->hs_tran_speed = 50000000;
 				}
 			}
+			mmc_app_sd_status(sc, ivar->rca, ivar->raw_sd_status);
+			mmc_app_decode_sd_status(ivar->raw_sd_status,
+			    &ivar->sd_status);
+			if (ivar->sd_status.au_size != 0) {
+				ivar->erase_sector =
+				    16 << ivar->sd_status.au_size;
+			}
 			mmc_select_card(sc, 0);
 			/* Find max supported bus width. */
 			if ((mmcbr_get_caps(sc->dev) & MMC_CAP_4_BIT_DATA) &&
@@ -1081,6 +1134,8 @@ mmc_discover_cards(struct mmc_softc *sc)
 		mmc_decode_csd_mmc(ivar->raw_csd, &ivar->csd);
 		ivar->sec_count = ivar->csd.capacity / MMC_SECTOR_SIZE;
 		ivar->tran_speed = ivar->csd.tran_speed;
+		ivar->erase_sector = ivar->csd.erase_sector * 
+		    ivar->csd.write_bl_len / MMC_SECTOR_SIZE;
 		/* Only MMC >= 4.x cards support EXT_CSD. */
 		if (ivar->csd.spec_vers >= 4) {
 			/* Card must be selected to fetch EXT_CSD. */
@@ -1108,6 +1163,13 @@ mmc_discover_cards(struct mmc_softc *sc)
 			/* Find max supported bus width. */
 			ivar->bus_width = mmc_test_bus_width(sc);
 			mmc_select_card(sc, 0);
+			/* Handle HC erase sector size. */
+			if (ivar->raw_ext_csd[EXT_CSD_ERASE_GRP_SIZE] != 0) {
+				ivar->erase_sector = 1024 *
+				    ivar->raw_ext_csd[EXT_CSD_ERASE_GRP_SIZE];
+				mmc_switch(sc, EXT_CSD_CMD_SET_NORMAL,
+				    EXT_CSD_ERASE_GRP_DEF, 1);
+			}
 		} else {
 			ivar->bus_width = bus_width_1;
 			ivar->timing = bus_timing_normal;
@@ -1278,6 +1340,9 @@ mmc_read_ivar(device_t bus, device_t chi
 	case MMC_IVAR_BUS_WIDTH:
 		*(int *)result = ivar->bus_width;
 		break;
+	case MMC_IVAR_ERASE_SECTOR:
+		*(int *)result = ivar->erase_sector;
+		break;
 	}
 	return (0);
 }

Modified: head/sys/dev/mmc/mmcreg.h
==============================================================================
--- head/sys/dev/mmc/mmcreg.h	Sat Oct 18 16:02:48 2008	(r184032)
+++ head/sys/dev/mmc/mmcreg.h	Sat Oct 18 16:17:04 2008	(r184033)
@@ -288,11 +288,14 @@ struct mmc_request {
  * EXT_CSD fields
  */
 
+#define EXT_CSD_ERASE_GRP_DEF	175	/* R/W */
 #define EXT_CSD_BUS_WIDTH	183	/* R/W */
 #define EXT_CSD_HS_TIMING	185	/* R/W */
 #define EXT_CSD_CARD_TYPE	196	/* RO */
 #define EXT_CSD_REV		192	/* RO */
 #define EXT_CSD_SEC_CNT		212	/* RO, 4 bytes */
+#define EXT_CSD_ERASE_TO_MULT	223	/* RO */
+#define EXT_CSD_ERASE_GRP_SIZE	224	/* RO */
 
 /*
  * EXT_CSD field definitions
@@ -379,7 +382,7 @@ struct mmc_csd 
 	uint32_t vdd_w_curr_min;
 	uint32_t vdd_w_curr_max;
 	uint32_t wp_grp_size;
-	uint32_t sector_size;	/* Erase sector size! */
+	uint32_t erase_sector;
 	uint64_t capacity;
 	unsigned int read_bl_partial:1,
 	    read_blk_misalign:1,
@@ -398,6 +401,20 @@ struct mmc_scr
 #define SD_SCR_BUS_WIDTH_4	(1<<2)
 };
 
+struct mmc_sd_status
+{
+	uint8_t			bus_width;
+	uint8_t			secured_mode;
+	uint16_t		card_type;
+	uint16_t		prot_area;
+	uint8_t			speed_class;
+	uint8_t			perf_move;
+	uint8_t			au_size;
+	uint16_t		erase_size;
+	uint8_t			erase_timeout;
+	uint8_t			erase_offset;
+};
+
 /*
  * Older versions of the MMC standard had a variable sector size.  However,
  * I've been able to find no old MMC or SD cards that have a non 512

Modified: head/sys/dev/mmc/mmcsd.c
==============================================================================
--- head/sys/dev/mmc/mmcsd.c	Sat Oct 18 16:02:48 2008	(r184032)
+++ head/sys/dev/mmc/mmcsd.c	Sat Oct 18 16:17:04 2008	(r184033)
@@ -133,10 +133,11 @@ mmcsd_attach(device_t dev)
 	// d->d_dump = mmcsd_dump;	Need polling mmc layer
 	d->d_name = "mmcsd";
 	d->d_drv1 = sc;
-	d->d_maxsize = MAXPHYS;		/* Maybe ask bridge? */
+	d->d_maxsize = 4*1024*1024;	/* Maximum defined SD card AU size. */
 	d->d_sectorsize = mmc_get_sector_size(dev);
 	d->d_mediasize = mmc_get_media_size(dev) * d->d_sectorsize;
 	d->d_unit = device_get_unit(dev);
+	d->d_flags = DISKFLAG_CANDELETE;
 	/*
 	 * Display in most natural units.  There's no cards < 1MB.
 	 * The SD standard goes to 2GiB, but the data format supports
@@ -216,6 +217,151 @@ mmcsd_strategy(struct bio *bp)
 	MMCSD_UNLOCK(sc);
 }
 
+static daddr_t
+mmcsd_rw(struct mmcsd_softc *sc, struct bio *bp)
+{
+	daddr_t block, end;
+	struct mmc_command cmd;
+	struct mmc_command stop;
+	struct mmc_request req;
+	struct mmc_data data;
+	device_t dev = sc->dev;
+	int sz = sc->disk->d_sectorsize;
+
+	block = bp->bio_pblkno;
+	end = bp->bio_pblkno + (bp->bio_bcount / sz);
+	while (block < end) {
+		char *vaddr = bp->bio_data +
+		    (block - bp->bio_pblkno) * sz;
+		int numblocks;
+#ifdef MULTI_BLOCK
+		numblocks = end - block;
+#else
+		numblocks = 1;
+#endif
+		memset(&req, 0, sizeof(req));
+    		memset(&cmd, 0, sizeof(cmd));
+		memset(&stop, 0, sizeof(stop));
+		req.cmd = &cmd;
+		cmd.data = &data;
+		if (bp->bio_cmd == BIO_READ) {
+			if (numblocks > 1)
+				cmd.opcode = MMC_READ_MULTIPLE_BLOCK;
+			else
+				cmd.opcode = MMC_READ_SINGLE_BLOCK;
+		} else {
+			if (numblocks > 1)
+				cmd.opcode = MMC_WRITE_MULTIPLE_BLOCK;
+			else
+				cmd.opcode = MMC_WRITE_BLOCK;
+		}
+		cmd.arg = block;
+		if (!mmc_get_high_cap(dev))
+			cmd.arg <<= 9;
+		cmd.flags = MMC_RSP_R1 | MMC_CMD_ADTC;
+		data.data = vaddr;
+		data.mrq = &req;
+		if (bp->bio_cmd == BIO_READ)
+			data.flags = MMC_DATA_READ;
+		else
+			data.flags = MMC_DATA_WRITE;
+		data.len = numblocks * sz;
+		if (numblocks > 1) {
+			data.flags |= MMC_DATA_MULTI;
+			stop.opcode = MMC_STOP_TRANSMISSION;
+			stop.arg = 0;
+			stop.flags = MMC_RSP_R1B | MMC_CMD_AC;
+			req.stop = &stop;
+		}
+//		printf("Len %d  %lld-%lld flags %#x sz %d\n",
+//		    (int)data.len, (long long)block, (long long)end, data.flags, sz);
+		MMCBUS_WAIT_FOR_REQUEST(device_get_parent(dev), dev,
+		    &req);
+		if (req.cmd->error != MMC_ERR_NONE)
+			break;
+		block += numblocks;
+	}
+	return (block);
+}
+
+static daddr_t
+mmcsd_delete(struct mmcsd_softc *sc, struct bio *bp)
+{
+	daddr_t block, end, start, stop;
+	struct mmc_command cmd;
+	struct mmc_request req;
+	device_t dev = sc->dev;
+	int sz = sc->disk->d_sectorsize;
+	int erase_sector;
+
+	block = bp->bio_pblkno;
+	end = bp->bio_pblkno + (bp->bio_bcount / sz);
+
+	/* Safe round to the erase sector boundaries. */
+	erase_sector = mmc_get_erase_sector(dev);
+	start = block + erase_sector - 1;	 /* Round up. */
+	start -= start % erase_sector;
+	stop = end;				/* Round down. */
+	stop -= end % erase_sector;	 
+
+	/* We can't erase areas smaller then sector. */
+	if (start >= stop)
+		return (end);
+
+	/* Set erase start position. */
+	memset(&req, 0, sizeof(req));
+	memset(&cmd, 0, sizeof(cmd));
+	req.cmd = &cmd;
+	if (mmc_get_card_type(dev) == mode_sd)
+		cmd.opcode = SD_ERASE_WR_BLK_START;
+	else
+		cmd.opcode = MMC_ERASE_GROUP_START;
+	cmd.arg = start;
+	if (!mmc_get_high_cap(dev))
+		cmd.arg <<= 9;
+	cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
+	MMCBUS_WAIT_FOR_REQUEST(device_get_parent(dev), dev,
+	    &req);
+	if (req.cmd->error != MMC_ERR_NONE) {
+	    printf("erase err1: %d\n", req.cmd->error);
+	    return (block);
+	}
+	/* Set erase stop position. */
+	memset(&req, 0, sizeof(req));
+	memset(&cmd, 0, sizeof(cmd));
+	req.cmd = &cmd;
+	if (mmc_get_card_type(dev) == mode_sd)
+		cmd.opcode = SD_ERASE_WR_BLK_END;
+	else
+		cmd.opcode = MMC_ERASE_GROUP_END;
+	cmd.arg = stop;
+	if (!mmc_get_high_cap(dev))
+		cmd.arg <<= 9;
+	cmd.arg--;
+	cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
+	MMCBUS_WAIT_FOR_REQUEST(device_get_parent(dev), dev,
+	    &req);
+	if (req.cmd->error != MMC_ERR_NONE) {
+	    printf("erase err2: %d\n", req.cmd->error);
+	    return (block);
+	}
+	/* Erase range. */
+	memset(&req, 0, sizeof(req));
+	memset(&cmd, 0, sizeof(cmd));
+	req.cmd = &cmd;
+	cmd.opcode = MMC_ERASE;
+	cmd.arg = 0;
+	cmd.flags = MMC_RSP_R1B | MMC_CMD_AC;
+	MMCBUS_WAIT_FOR_REQUEST(device_get_parent(dev), dev,
+	    &req);
+	if (req.cmd->error != MMC_ERR_NONE) {
+	    printf("erase err3 %d\n", req.cmd->error);
+	    return (block);
+	}
+
+	return (end);
+}
+
 static void
 mmcsd_task(void *arg)
 {
@@ -223,10 +369,6 @@ mmcsd_task(void *arg)
 	struct bio *bp;
 	int sz;
 	daddr_t block, end;
-	struct mmc_command cmd;
-	struct mmc_command stop;
-	struct mmc_request req;
-	struct mmc_data data;
 	device_t dev;
 
 	dev = sc->dev;
@@ -242,7 +384,6 @@ mmcsd_task(void *arg)
 		MMCSD_UNLOCK(sc);
 		if (!sc->running)
 			break;
-//		printf("mmc_task: request %p for block %ju\n", bp, bp->bio_pblkno);
 		if (bp->bio_cmd != BIO_READ && mmc_get_read_only(dev)) {
 			bp->bio_error = EROFS;
 			bp->bio_resid = bp->bio_bcount;
@@ -252,56 +393,15 @@ mmcsd_task(void *arg)
 		}
 		MMCBUS_ACQUIRE_BUS(device_get_parent(dev), dev);
 		sz = sc->disk->d_sectorsize;
+		block = bp->bio_pblkno;
 		end = bp->bio_pblkno + (bp->bio_bcount / sz);
-		for (block = bp->bio_pblkno; block < end;) {
-			char *vaddr = bp->bio_data + (block - bp->bio_pblkno) * sz;
-			int numblocks;
-#ifdef MULTI_BLOCK
-			numblocks = end - block;
-#else
-			numblocks = 1;
-#endif
-			memset(&req, 0, sizeof(req));
-			memset(&cmd, 0, sizeof(cmd));
-			memset(&stop, 0, sizeof(stop));
-			req.cmd = &cmd;
-			cmd.data = &data;
-			if (bp->bio_cmd == BIO_READ) {
-				if (numblocks > 1)
-					cmd.opcode = MMC_READ_MULTIPLE_BLOCK;
-				else
-					cmd.opcode = MMC_READ_SINGLE_BLOCK;
-			} else {
-				if (numblocks > 1)
-					cmd.opcode = MMC_WRITE_MULTIPLE_BLOCK;
-				else
-					cmd.opcode = MMC_WRITE_BLOCK;
-			}
-			cmd.arg = block;
-			if (!mmc_get_high_cap(dev))
-				cmd.arg <<= 9;
-			cmd.flags = MMC_RSP_R1 | MMC_CMD_ADTC;
-			data.data = vaddr;
-			data.mrq = &req;
-			if (bp->bio_cmd == BIO_READ)
-				data.flags = MMC_DATA_READ;
-			else
-				data.flags = MMC_DATA_WRITE;
-			data.len = numblocks * sz;
-			if (numblocks > 1) {
-				data.flags |= MMC_DATA_MULTI;
-				stop.opcode = MMC_STOP_TRANSMISSION;
-				stop.arg = 0;
-				stop.flags = MMC_RSP_R1B | MMC_CMD_AC;
-				req.stop = &stop;
-			}
-//			printf("Len %d  %lld-%lld flags %#x sz %d\n",
-//			    (int)data.len, (long long)block, (long long)end, data.flags, sz);
-			MMCBUS_WAIT_FOR_REQUEST(device_get_parent(dev), dev,
-			    &req);
-			if (req.cmd->error != MMC_ERR_NONE)
-				break;
-			block += numblocks;
+		if (bp->bio_cmd == BIO_READ || bp->bio_cmd == BIO_WRITE) {
+			block = mmcsd_rw(sc, bp);
+		} else if (bp->bio_cmd == BIO_DELETE) {
+			block = mmcsd_delete(sc, bp);
+		} else {
+			/* UNSUPPORTED COMMAND */
+			block = bp->bio_pblkno;
 		}
 		MMCBUS_RELEASE_BUS(device_get_parent(dev), dev);
 		if (block < end) {

Modified: head/sys/dev/mmc/mmcvar.h
==============================================================================
--- head/sys/dev/mmc/mmcvar.h	Sat Oct 18 16:02:48 2008	(r184032)
+++ head/sys/dev/mmc/mmcvar.h	Sat Oct 18 16:17:04 2008	(r184033)
@@ -67,6 +67,7 @@ enum mmc_device_ivars {
     MMC_IVAR_HIGH_CAP,
     MMC_IVAR_CARD_TYPE,
     MMC_IVAR_BUS_WIDTH,
+    MMC_IVAR_ERASE_SECTOR,
 //    MMC_IVAR_,
 };
 
@@ -85,5 +86,6 @@ MMC_ACCESSOR(read_only, READ_ONLY, int)
 MMC_ACCESSOR(high_cap, HIGH_CAP, int)
 MMC_ACCESSOR(card_type, CARD_TYPE, int)
 MMC_ACCESSOR(bus_width, BUS_WIDTH, int)
+MMC_ACCESSOR(erase_sector, ERASE_SECTOR, int)
 
 #endif /* DEV_MMC_MMCVAR_H */

From owner-svn-src-head@FreeBSD.ORG  Sat Oct 18 22:22:25 2008
Return-Path: 
Delivered-To: svn-src-head@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A09C61065687;
	Sat, 18 Oct 2008 22:22:25 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8EAE78FC08;
	Sat, 18 Oct 2008 22:22:25 +0000 (UTC) (envelope-from mav@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9IMMPge027185;
	Sat, 18 Oct 2008 22:22:25 GMT (envelope-from mav@svn.freebsd.org)
Received: (from mav@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9IMMPk4027184;
	Sat, 18 Oct 2008 22:22:25 GMT (envelope-from mav@svn.freebsd.org)
Message-Id: <200810182222.m9IMMPk4027184@svn.freebsd.org>
From: Alexander Motin 
Date: Sat, 18 Oct 2008 22:22:25 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-head@freebsd.org
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r184034 - head/sys/dev/mmc
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
	
List-Unsubscribe: ,
	
List-Archive: 
List-Post: 
List-Help: 
List-Subscribe: ,
	
X-List-Received-Date: Sat, 18 Oct 2008 22:22:25 -0000

Author: mav
Date: Sat Oct 18 22:22:25 2008
New Revision: 184034
URL: http://svn.freebsd.org/changeset/base/184034

Log:
  Coalesce sequentional BIO_DELETE requests to slightly relax size and alignment
  constraints required by the card.

Modified:
  head/sys/dev/mmc/mmcsd.c

Modified: head/sys/dev/mmc/mmcsd.c
==============================================================================
--- head/sys/dev/mmc/mmcsd.c	Sat Oct 18 16:17:04 2008	(r184033)
+++ head/sys/dev/mmc/mmcsd.c	Sat Oct 18 22:22:25 2008	(r184034)
@@ -77,6 +77,7 @@ struct mmcsd_softc {
 	struct disk *disk;
 	struct proc *p;
 	struct bio_queue_head bio_queue;
+	daddr_t eblock, eend;	/* Range remaining after the last erase. */
 	int running;
 };
 
@@ -162,6 +163,7 @@ mmcsd_attach(device_t dev)
 	bioq_init(&sc->bio_queue);
 
 	sc->running = 1;
+	sc->eblock = sc->eend = 0;
 	kproc_create(&mmcsd_task, sc, &sc->p, 0, 0, "task: mmc/sd card");
 
 	return (0);
@@ -296,17 +298,23 @@ mmcsd_delete(struct mmcsd_softc *sc, str
 
 	block = bp->bio_pblkno;
 	end = bp->bio_pblkno + (bp->bio_bcount / sz);
-
+	/* Coalesce with part remaining from previous request. */
+	if (block > sc->eblock && block <= sc->eend)
+		block = sc->eblock;
+	if (end >= sc->eblock && end < sc->eend)
+		end = sc->eend;
 	/* Safe round to the erase sector boundaries. */
 	erase_sector = mmc_get_erase_sector(dev);
 	start = block + erase_sector - 1;	 /* Round up. */
 	start -= start % erase_sector;
 	stop = end;				/* Round down. */
 	stop -= end % erase_sector;	 
-
-	/* We can't erase areas smaller then sector. */
-	if (start >= stop)
+	/* We can't erase area smaller then sector, store it for later. */
+	if (start >= stop) {
+		sc->eblock = block;
+		sc->eend = end;
 		return (end);
+	}
 
 	/* Set erase start position. */
 	memset(&req, 0, sizeof(req));
@@ -358,7 +366,14 @@ mmcsd_delete(struct mmcsd_softc *sc, str
 	    printf("erase err3 %d\n", req.cmd->error);
 	    return (block);
 	}
-
+	/* Store one of remaining parts for the next call. */
+	if (bp->bio_pblkno >= sc->eblock || block == start) {
+		sc->eblock = stop;	/* Predict next forward. */
+		sc->eend = end;
+	} else {
+		sc->eblock = block;	/* Predict next backward. */
+		sc->eend = start;
+	}
 	return (end);
 }
 
@@ -396,12 +411,12 @@ mmcsd_task(void *arg)
 		block = bp->bio_pblkno;
 		end = bp->bio_pblkno + (bp->bio_bcount / sz);
 		if (bp->bio_cmd == BIO_READ || bp->bio_cmd == BIO_WRITE) {
+			/* Access to the remaining erase block obsoletes it. */
+			if (block < sc->eend && end > sc->eblock)
+				sc->eblock = sc->eend = 0;
 			block = mmcsd_rw(sc, bp);
 		} else if (bp->bio_cmd == BIO_DELETE) {
 			block = mmcsd_delete(sc, bp);
-		} else {
-			/* UNSUPPORTED COMMAND */
-			block = bp->bio_pblkno;
 		}
 		MMCBUS_RELEASE_BUS(device_get_parent(dev), dev);
 		if (block < end) {