svn commit: r365050 - head/sys/dev/intel
Author: takawata Date: Tue Sep 1 15:33:57 2020 New Revision: 365050 URL: https://svnweb.freebsd.org/changeset/base/365050 Log: Add Cannon Point PCH Thermal Controller Device ID. PR: 249047 Reported by: Dries Michiels --This line, and those below, will be ignored-- > Description of fields to fill in above: 76 columns --| > PR: If and which Problem Report is related. > Submitted by: If someone else sent in the change. > Reported by: If someone else reported the issue. > Reviewed by: If someone else reviewed your modification. > Approved by: If you needed approval for this commit. > Obtained from:If the change is from a third party. > MFC after:N [day[s]|week[s]|month[s]]. Request a reminder email. > MFH: Ports tree branch name. Request approval for merge. > Relnotes: Set to 'yes' for mention in release notes. > Security: Vulnerability reference (one per line) or description. > Sponsored by: If the change was sponsored by an organization (each collaborator). > Differential Revision:https://reviews.freebsd.org/D### (*full* phabric URL needed). > Empty fields above will be automatically removed. Mpchtherm.c Modified: head/sys/dev/intel/pchtherm.c Modified: head/sys/dev/intel/pchtherm.c == --- head/sys/dev/intel/pchtherm.c Tue Sep 1 15:30:40 2020 (r365049) +++ head/sys/dev/intel/pchtherm.c Tue Sep 1 15:33:57 2020 (r365050) @@ -95,6 +95,8 @@ static const struct pci_device_table pchtherm_devices[ PCI_DESCR("Skylake PCH Thermal Subsystem")}, { PCI_DEV(0x8086, 0xa131), PCI_DESCR("Skylake PCH 100 Thermal Subsystem")}, + { PCI_DEV(0x8086, 0x9df9), + PCI_DESCR("Cannon Lake PCH Thermal Controller")}, }; static int pchtherm_probe(device_t dev) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r363276 - in head/sys/netgraph/bluetooth: include l2cap
Author: takawata Date: Fri Jul 17 15:50:03 2020 New Revision: 363276 URL: https://svnweb.freebsd.org/changeset/base/363276 Log: Fix L2CAP ACL packet PB(Packet Boundary) flag for LE PDU. ACL packet boundary flag should be 0 instead of 2 for LE PDU. Some HCI will drop LE packet with PB flag is 2, and if sent, some target may reject the packet. PR: 248024 Reported by: Greg V Reviewed by: Greg V, emax Differential Revision:https://reviews.freebsd.org/D25704 Modified: head/sys/netgraph/bluetooth/include/ng_hci.h head/sys/netgraph/bluetooth/l2cap/ng_l2cap_llpi.c Modified: head/sys/netgraph/bluetooth/include/ng_hci.h == --- head/sys/netgraph/bluetooth/include/ng_hci.hFri Jul 17 15:09:49 2020(r363275) +++ head/sys/netgraph/bluetooth/include/ng_hci.hFri Jul 17 15:50:03 2020(r363276) @@ -393,10 +393,10 @@ (((h) & 0x0fff) | (((pb) & 3) << 12) | (((bc) & 3) << 14)) /* PB flag values */ - /* 00 - reserved for future use */ +#defineNG_HCI_LE_PACKET_START 0x0 #defineNG_HCI_PACKET_FRAGMENT 0x1 #defineNG_HCI_PACKET_START 0x2 - /* 11 - reserved for future use */ + /* 11 for AMP packet, not supported */ /* BC flag values */ #define NG_HCI_POINT2POINT 0x0 /* only Host controller to Host */ Modified: head/sys/netgraph/bluetooth/l2cap/ng_l2cap_llpi.c == --- head/sys/netgraph/bluetooth/l2cap/ng_l2cap_llpi.c Fri Jul 17 15:09:49 2020(r363275) +++ head/sys/netgraph/bluetooth/l2cap/ng_l2cap_llpi.c Fri Jul 17 15:50:03 2020(r363276) @@ -547,7 +547,7 @@ ng_l2cap_lp_send(ng_l2cap_con_p con, u_int16_t dcid, s ng_l2cap_hdr_t *l2cap_hdr = NULL; ng_hci_acldata_pkt_t *acl_hdr = NULL; struct mbuf*m_last = NULL, *m = NULL; -int len, flag = NG_HCI_PACKET_START; +int len, flag = (con->linktype == NG_HCI_LINK_ACL) ? NG_HCI_PACKET_START : NG_HCI_LE_PACKET_START; KASSERT((con->tx_pkt == NULL), ("%s: %s - another packet pending?!\n", __func__, NG_NODE_NAME(l2cap->node))); @@ -713,7 +713,8 @@ ng_l2cap_lp_receive(ng_l2cap_p l2cap, struct mbuf *m) } /* Process packet */ - if (pb == NG_HCI_PACKET_START) { + if ((pb == NG_HCI_PACKET_START) || (pb == NG_HCI_LE_PACKET_START)) + { if (con->rx_pkt != NULL) { NG_L2CAP_ERR( "%s: %s - dropping incomplete L2CAP packet, got %d bytes, want %d bytes\n", ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r363003 - head/sys/netgraph/bluetooth/include
Author: takawata Date: Wed Jul 8 06:33:07 2020 New Revision: 363003 URL: https://svnweb.freebsd.org/changeset/base/363003 Log: Add support for [read|write] supported data length commands. Fix ng_hci_le_long_term_key_request_negative_reply_cp struct while here. PR: 247809 Submitted by: Marc Veldman Modified: head/sys/netgraph/bluetooth/include/ng_hci.h Modified: head/sys/netgraph/bluetooth/include/ng_hci.h == --- head/sys/netgraph/bluetooth/include/ng_hci.hWed Jul 8 03:57:47 2020(r363002) +++ head/sys/netgraph/bluetooth/include/ng_hci.hWed Jul 8 06:33:07 2020(r363003) @@ -1730,11 +1730,26 @@ typedef struct { #define NG_HCI_OCF_LE_LONG_TERM_KEY_REQUEST_NEGATIVE_REPLY 0x001b typedef struct{ u_int16_t connection_handle; -}ng_hci_le_long_term_key_request_negative_reply_cp; +}__attribute__((packed)) ng_hci_le_long_term_key_request_negative_reply_cp; typedef struct { u_int8_t status; u_int16_t connection_handle; }__attribute__ ((packed)) ng_hci_le_long_term_key_request_negative_reply_rp; + +#define NG_HCI_OCF_LE_READ_SUGGESTED_DATA_LENGTH 0x0023 +/*No command parameter*/ +typedef struct { + u_int8_t status; + u_int16_t suggested_max_tx_octets; + u_int16_t suggested_max_tx_time; +}__attribute__ ((packed)) ng_hci_le_read_suggested_data_length_rp; + +#define NG_HCI_OCF_LE_WRITE_SUGGESTED_DATA_LENGTH 0x0024 +typedef struct { + u_int16_t suggested_max_tx_octets; + u_int16_t suggested_max_tx_time; +}__attribute__ ((packed)) ng_hci_le_write_suggested_data_length_cp; +typedef ng_hci_status_rp ng_hci_le_write_suggested_data_length_rp; #define NG_HCI_OCF_LE_READ_BUFFER_SIZE_V2 0x0060 /*No command parameter */ ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r363002 - head/usr.sbin/bluetooth/hccontrol
Author: takawata Date: Wed Jul 8 03:57:47 2020 New Revision: 363002 URL: https://svnweb.freebsd.org/changeset/base/363002 Log: Add le_rand command. PR: 247808 Submitted by: Marc Veldman Modified: head/usr.sbin/bluetooth/hccontrol/hccontrol.8 head/usr.sbin/bluetooth/hccontrol/le.c Modified: head/usr.sbin/bluetooth/hccontrol/hccontrol.8 == --- head/usr.sbin/bluetooth/hccontrol/hccontrol.8 Wed Jul 8 02:28:08 2020(r363001) +++ head/usr.sbin/bluetooth/hccontrol/hccontrol.8 Wed Jul 8 03:57:47 2020(r363002) @@ -164,6 +164,7 @@ are: .It Cm LE_Connect .It Cm LE_Read_Channel_Map .It Cm LE_Read_Remote_Features +.It Cm LE_Rand .El .Pp The currently supported node commands in Modified: head/usr.sbin/bluetooth/hccontrol/le.c == --- head/usr.sbin/bluetooth/hccontrol/le.c Wed Jul 8 02:28:08 2020 (r363001) +++ head/usr.sbin/bluetooth/hccontrol/le.c Wed Jul 8 03:57:47 2020 (r363002) @@ -71,6 +71,7 @@ static int le_connect(int s, int argc, char *argv[]); static void handle_le_connection_event(ng_hci_event_pkt_t* e, bool verbose); static int le_read_channel_map(int s, int argc, char *argv[]); static void handle_le_remote_features_event(ng_hci_event_pkt_t* e); +static int le_rand(int s, int argc, char *argv[]); static int le_set_scan_param(int s, int argc, char *argv[]) @@ -1211,8 +1212,33 @@ static void handle_le_remote_features_event(ng_hci_eve return; } /* handle_le_remote_features_event */ +static int le_rand(int s, int argc, char *argv[]) +{ + ng_hci_le_rand_rp rp; + int n; + n = sizeof(rp); + if (hci_simple_request(s, NG_HCI_OPCODE(NG_HCI_OGF_LE, + NG_HCI_OCF_LE_RAND), + (void *)&rp, &n) == ERROR) + return (ERROR); + + if (rp.status != 0x00) { + fprintf(stdout, "Status: %s [%#02x]\n", + hci_status2str(rp.status), rp.status); + return (FAILED); + } + + fprintf(stdout, + "Random number : %08llx\n", + (unsigned long long)le64toh(rp.random_number)); + + return (OK); +} + + + struct hci_command le_commands[] = { { "le_enable", @@ -1335,5 +1361,11 @@ struct hci_command le_commands[] = { "Read supported features for the device\n" "identified by the connection handle", &le_read_remote_features + }, + { + "le_rand", + "le_rand\n" + "Generate 64 bits of random data", + &le_rand }, }; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r362825 - head/sys/netgraph/bluetooth/socket
Author: takawata Date: Wed Jul 1 04:00:54 2020 New Revision: 362825 URL: https://svnweb.freebsd.org/changeset/base/362825 Log: Allow some Bluetooth LE related HCI request to non-root user. PR: 247588 Reported by: Greg V (greg@unrelenting.technology) Reviewed by: emax Differential Revision:https://reviews.freebsd.org/D25516 Modified: head/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c Modified: head/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c == --- head/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.cWed Jul 1 02:32:41 2020(r362824) +++ head/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.cWed Jul 1 04:00:54 2020(r362825) @@ -861,6 +861,7 @@ ng_btsocket_hci_raw_init(void) bit_set(f, NG_HCI_OCF_READ_IAC_LAP - 1); bit_set(f, NG_HCI_OCF_READ_PAGE_SCAN_PERIOD - 1); bit_set(f, NG_HCI_OCF_READ_PAGE_SCAN - 1); + bit_set(f, NG_HCI_OCF_READ_LE_HOST_SUPPORTED -1); /* Commands - Informational */ f = ng_btsocket_hci_raw_sec_filter->commands[NG_HCI_OGF_INFO - 1]; @@ -881,6 +882,11 @@ ng_btsocket_hci_raw_init(void) bit_set(f, NG_HCI_OCF_READ_LOOPBACK_MODE - 1); /*Commands - LE*/ f = ng_btsocket_hci_raw_sec_filter->commands[NG_HCI_OGF_LE -1]; + bit_set(f, NG_HCI_OCF_LE_SET_SCAN_ENABLE - 1); + bit_set(f, NG_HCI_OCF_LE_SET_SCAN_PARAMETERS - 1); + bit_set(f, NG_HCI_OCF_LE_READ_LOCAL_SUPPORTED_FEATURES - 1); + bit_set(f, NG_HCI_OCF_LE_READ_BUFFER_SIZE - 1); + bit_set(f, NG_HCI_OCF_LE_READ_WHITE_LIST_SIZE - 1); } /* ng_btsocket_hci_raw_init */ ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r362199 - head/sys/netgraph/bluetooth/include
Author: takawata Date: Mon Jun 15 14:58:40 2020 New Revision: 362199 URL: https://svnweb.freebsd.org/changeset/base/362199 Log: Update event masks constant to Bluetooth core spec V5.2 and add LE Events. PR: 247257 Submitted by: Marc Veldman Modified: head/sys/netgraph/bluetooth/include/ng_hci.h Modified: head/sys/netgraph/bluetooth/include/ng_hci.h == --- head/sys/netgraph/bluetooth/include/ng_hci.hMon Jun 15 13:46:40 2020(r362198) +++ head/sys/netgraph/bluetooth/include/ng_hci.hMon Jun 15 14:58:40 2020(r362199) @@ -225,7 +225,8 @@ /* 0x0010 - 0x8000 - reserved for future use */ /* Event masks */ -#define NG_HCI_EVMSK_ALL 0x +#define NG_HCI_EVMSK_DEFAULT 0x1fff +#define NG_HCI_EVMSK_ALL 0x1fff #define NG_HCI_EVMSK_NONE 0x #define NG_HCI_EVMSK_INQUIRY_COMPL 0x0001 #define NG_HCI_EVMSK_INQUIRY_RESULT0x0002 @@ -259,7 +260,70 @@ #define NG_HCI_EVMSK_QOS_VIOLATION 0x2000 #define NG_HCI_EVMSK_PAGE_SCAN_MODE_CHANGE 0x4000 #define NG_HCI_EVMSK_PAGE_SCAN_REP_MODE_CHANGE 0x8000 -/* 0x0001 - 0x8000 - reserved for future use */ +#define NG_HCI_EVMSK_FLOW_SPEC_COMPL 0x0001 +#define NG_HCI_EVMSK_INQUIRY_RESULT_W_RSSI 0x0002 +#define NG_HCI_EVMSK_READ_REM_EXT_FEAT_COMPL 0x0004 + +/* 0x0008 -0x0800 - not in use */ + +#define NG_HCI_EVMSK_SYNC_CONN_COMPL 0x1000 +#define NG_HCI_EVMSK_SYNC_CONN_CHANGED 0x2000 +#define NG_HCI_EVMSK_SNIFF_SUBRATING 0x4000 +#define NG_HCI_EVMSK_EXT_INQUIRY_RESULT0x8000 +#define NG_HCI_EVMSK_ENC_KEY_REFRESH_COMPL 0x0001 +#define NG_HCI_EVMSK_IO_CAPABILITY_REQ 0x0002 +#define NG_HCI_EVMSK_IO_CAPABILITY_RESP0x0004 +#define NG_HCI_EVMSK_USER_CONFIRMATION_REQ 0x0008 +#define NG_HCI_EVMSK_USER_PASSKEY_REQ 0x0010 +#define NG_HCI_EVMSK_REM_OOB_DATA_REQ 0x0020 +#define NG_HCI_EVMSK_SIMPLE_PAIRING_COMPL 0x0040 +#define NG_HCI_EVMSK_LINK_SUPERV_TO_CHANGED0x0080 +#define NG_HCI_EVMSK_ENH_FLUSH_COMPL 0x0100 +#define NG_HCI_EVMSK_USER_PASSKEY_NOTIFICATION 0x0200 +#define NG_HCI_EVMSK_KEYPRESS_NOTIFICATION 0x0400 +#define NG_HCI_EVMSK_REM_HOST_SUPP_FEAT_NOTIFI 0x0800 +#define NG_HCI_EVMSK_LE_META 0x1000 +/* 0x1001 - 0x8000 - reserved for future use */ + +/* LE events masks*/ +#define NG_HCI_LEEVMSK_ALL 0x3fff +#define NG_HCI_LEEVMSK_NONE0x +#define NG_HCI_LEEVMSK_DEFAULT 0x001f +#define NG_HCI_LEEVMSK_CONN_COMPLETE 0x0001 +#define NG_HCI_LEEVMSK_ADV_REP 0x0002 +#define NG_HCI_LEEVMSK_CONN_UPDATE 0x0004 +#define NG_HCI_LEEVMSK_READ_REM_FEAT_REQ 0x0008 +#define NG_HCI_LEEVMSK_LONG_TERM_KEY_REQ 0x0010 +#define NG_HCI_LEEVMSK_REM_CONN_PARAM_REQ 0x0020 +#define NG_HCI_LEEVMSK_DATA_LENGTH_CHG 0x0040 +#define NG_HCI_LEEVMSK_RD_LOC_P256_PK_COMPL0x0080 +#define NG_HCI_LEEVMSK_GEN_DHKEY_COMPL 0x0100 +#define NG_HCI_LEEVMSK_ENH_CONN_COMPL 0x0200 +#define NG_HCI_LEEVMSK_DIR_ADV_REP 0x0400 +#define NG_HCI_LEEVMSK_PHY_UPD_COMPL 0x0800 +#define NG_HCI_LEEVMSK_EXT_ADV_REP 0x1000 +#define NG_HCI_LEEVMSK_PER_ADV_SYNC_EST0x2000 +#define NG_HCI_LEEVMSK_PER_ADV_REP 0x4000 +#define NG_HCI_LEEVMSK_PER_ADV_SYNC_LOST 0x8000 +#define NG_HCI_LEEVMSK_SCAN_TIMEOUT0x0001 +#define NG_HCI_LEEVMSK_ADV_SET_TERM0x0002 +#define NG_HCI_LEEVMSK_SCAN_REQ_RCVD 0x0004 +#define NG_HCI_LEEVMSK_CHAN_SEL_ALGO 0x0008 +#define NG_HCI_LEEVMSK_CONNLESS_IQ_REP 0x0001 +#define NG_HCI_LEEVMSK_CONN_IQ_REP 0x0002 +#define NG_HCI_LEEVMSK_CTE_REQ_FAILED 0x0004 +#define NG_HCI_LEEVMSK_PER_ADV_SYN_TRF_RCVD0x0008 +#define NG_HCI_LEEVMSK_CIS_EST 0x0010 +#define NG_HCI_LEEVMSK_CIS_REQ 0x0020 +#define NG_HCI_LEEVMSK_CREATE_BIG_COMPL0x0040 +#define NG
svn commit: r362005 - head/usr.sbin/bluetooth/hccontrol
Author: takawata Date: Wed Jun 10 05:01:00 2020 New Revision: 362005 URL: https://svnweb.freebsd.org/changeset/base/362005 Log: Add le_read_channel_map and le_read_remote_features command PR: 247051 Submitted by: Marc Veldman marc at bumblingdork.com Modified: head/usr.sbin/bluetooth/hccontrol/hccontrol.8 head/usr.sbin/bluetooth/hccontrol/hccontrol.h head/usr.sbin/bluetooth/hccontrol/host_controller_baseband.c head/usr.sbin/bluetooth/hccontrol/le.c head/usr.sbin/bluetooth/hccontrol/util.c Modified: head/usr.sbin/bluetooth/hccontrol/hccontrol.8 == --- head/usr.sbin/bluetooth/hccontrol/hccontrol.8 Wed Jun 10 04:54:02 2020(r362004) +++ head/usr.sbin/bluetooth/hccontrol/hccontrol.8 Wed Jun 10 05:01:00 2020(r362005) @@ -162,6 +162,8 @@ are: .It Cm LE_Add_Device_To_White_List .It Cm LE_Remove_Device_From_White_List .It Cm LE_Connect +.It Cm LE_Read_Channel_Map +.It Cm LE_Read_Remote_Features .El .Pp The currently supported node commands in Modified: head/usr.sbin/bluetooth/hccontrol/hccontrol.h == --- head/usr.sbin/bluetooth/hccontrol/hccontrol.h Wed Jun 10 04:54:02 2020(r362004) +++ head/usr.sbin/bluetooth/hccontrol/hccontrol.h Wed Jun 10 05:01:00 2020(r362005) @@ -82,6 +82,7 @@ char const * hci_bdaddr2str (bdaddr_t const *); char const * hci_addrtype2str(int type); char const *hci_role2str(int role); char const *hci_mc_accuracy2str (int accuracy); +char const * hci_le_chanmap2str (uint8_t *, char *, int); void dump_adv_data(int len, uint8_t* advdata); void print_adv_data(int len, uint8_t* advdata); Modified: head/usr.sbin/bluetooth/hccontrol/host_controller_baseband.c == --- head/usr.sbin/bluetooth/hccontrol/host_controller_baseband.cWed Jun 10 04:54:02 2020(r362004) +++ head/usr.sbin/bluetooth/hccontrol/host_controller_baseband.cWed Jun 10 05:01:00 2020(r362005) @@ -1526,14 +1526,14 @@ hci_write_le_host_support(int s, int argc, char **argv switch (argc) { case 2: if (sscanf(argv[1], "%d", &n) != 1 || (n != 0 && n != 1)){ - printf("ARGC2: %d\n", n); + printf("-ARGC2: %d\n", n); return (USAGE); } cp.simultaneous_le_host = (n &1); case 1: if (sscanf(argv[0], "%d", &n) != 1 || (n != 0 && n != 1)){ - printf("ARGC1: %d\n", n); + printf("+ARGC1: %d\n", n); return (USAGE); } Modified: head/usr.sbin/bluetooth/hccontrol/le.c == --- head/usr.sbin/bluetooth/hccontrol/le.c Wed Jun 10 04:54:02 2020 (r362004) +++ head/usr.sbin/bluetooth/hccontrol/le.c Wed Jun 10 05:01:00 2020 (r362005) @@ -69,6 +69,8 @@ static int le_add_device_to_white_list(int s, int argc static int le_remove_device_from_white_list(int s, int argc, char *argv[]); static int le_connect(int s, int argc, char *argv[]); static void handle_le_connection_event(ng_hci_event_pkt_t* e, bool verbose); +static int le_read_channel_map(int s, int argc, char *argv[]); +static void handle_le_remote_features_event(ng_hci_event_pkt_t* e); static int le_set_scan_param(int s, int argc, char *argv[]) @@ -1086,6 +1088,131 @@ static void handle_le_connection_event(ng_hci_event_pk return; } +static int +le_read_channel_map(int s, int argc, char *argv[]) +{ + ng_hci_le_read_channel_map_cp cp; + ng_hci_le_read_channel_map_rp rp; + int n; + charbuffer[2048]; + + /* parse command parameters */ + switch (argc) { + case 1: + /* connection handle */ + if (sscanf(argv[0], "%d", &n) != 1 || n <= 0 || n > 0x0eff) + return (USAGE); + + cp.connection_handle = (uint16_t) (n & 0x0fff); + cp.connection_handle = htole16(cp.connection_handle); + break; + + default: + return (USAGE); + } + + n = sizeof(rp); + if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_LE, + NG_HCI_OCF_LE_READ_CHANNEL_MAP), + (void *)&cp, sizeof(cp), (void *)&rp, &n) == ERROR) + return (ERROR); + + if (rp.status != 0x00) { + fprintf(stdout, + "Read channel map failed. Status: %s [%#02x]\n", + hci_status2str(rp.status), rp.status); + return (FAILED); + } + + fprintf(stdout, "Connection handle: %d\n", +
svn commit: r362004 - head/sys/netgraph/bluetooth/include
Author: takawata Date: Wed Jun 10 04:54:02 2020 New Revision: 362004 URL: https://svnweb.freebsd.org/changeset/base/362004 Log: Add LE events: READ_REMOTE_FEATURES_COMPL LONG_TERM_KEY_REQUEST REMOTE_CONN_PARAM_REQUEST DATA_LENGTH_CHANGE READ_LOCAL_P256_PK_COMPL GEN_DHKEY_COMPL ENH_CONN_COMPL PR: 247050 Submitted by: Marc Veldman marc at bumblingdork.com Modified: head/sys/netgraph/bluetooth/include/ng_hci.h Modified: head/sys/netgraph/bluetooth/include/ng_hci.h == --- head/sys/netgraph/bluetooth/include/ng_hci.hWed Jun 10 04:08:16 2020(r362003) +++ head/sys/netgraph/bluetooth/include/ng_hci.hWed Jun 10 04:54:02 2020(r362004) @@ -1992,11 +1992,65 @@ typedef struct { u_int16_t conn_latency; u_int16_t supervision_timeout; }__attribute__((packed)) ng_hci_connection_update_complete_ep; + #define NG_HCI_LEEV_READ_REMOTE_FEATURES_COMPL 0x04 -//TBD +typedef struct { + u_int8_tstatus; + u_int16_t connection_handle; + u_int8_tfeatures[NG_HCI_FEATURES_SIZE]; +}__attribute__((packed)) ng_hci_le_read_remote_features_ep; + #define NG_HCI_LEEV_LONG_TERM_KEY_REQUEST 0x05 -//TBD +typedef struct { + u_int16_t connection_handle; + u_int64_t random_number; + u_int16_t encrypted_diversifier; +}__attribute__((packed)) ng_hci_le_long_term_key_request_ep; +#define NG_HCI_LEEV_REMOTE_CONN_PARAM_REQUEST 0x06 +typedef struct { + u_int16_t connection_handle; + u_int16_t interval_min; + u_int16_t interval_max; + u_int16_t latency; + u_int16_t timeout; +}__attribute__((packed)) ng_hci_le_remote_conn_param_ep; + +#define NG_HCI_LEEV_DATA_LENGTH_CHANGE 0x07 +typedef struct { + u_int16_t connection_handle; + u_int16_t min_tx_octets; + u_int16_t max_tx_time; + u_int16_t max_rx_octets; + u_int16_t max_rx_time; +}__attribute__((packed)) ng_hci_le_data_length_change_ep; + +#define NG_HCI_LEEV_READ_LOCAL_P256_PK_COMPL 0x08 +typedef struct { + u_int8_tstatus; + u_int8_tlocal_p256_pk[64]; +}__attribute__((packed)) ng_hci_le_read_local_p256_pk_compl_ep; + +#define NG_HCI_LEEV_GEN_DHKEY_COMPL 0x09 +typedef struct { + u_int8_tstatus; + u_int8_tdh_key[32]; +}__attribute__((packed)) ng_hci_le_gen_dhkey_compl_ep; + +#define NG_HCI_LEEV_ENH_CONN_COMPL 0x0a +typedef struct { + u_int8_tstatus; + u_int16_t connection_handle; + u_int8_trole; + u_int8_tpeer_addr_type; + bdaddr_tpeer_addr; + bdaddr_tlocal_res_private_addr; + bdaddr_tpeer_res_private_addr; + u_int16_t conn_interval; + u_int16_t conn_latency; + u_int16_t supervision_timeout; + u_int8_tmaster_clock_accuracy; +}__attribute__((packed)) ng_hci_le_enh_conn_compl_ep; #define NG_HCI_EVENT_BT_LOGO 0xfe ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r361586 - head/usr.sbin/bluetooth/hccontrol
Author: takawata Date: Thu May 28 13:48:33 2020 New Revision: 361586 URL: https://svnweb.freebsd.org/changeset/base/361586 Log: Fix connection event message string (n->\n) PR: 246664 Submitted by: Marc Veldman (m...@bumblngdork.com) Reported by: Jose Luis Duran (jldu...@gmail.com) Modified: head/usr.sbin/bluetooth/hccontrol/le.c Modified: head/usr.sbin/bluetooth/hccontrol/le.c == --- head/usr.sbin/bluetooth/hccontrol/le.c Thu May 28 13:19:41 2020 (r361585) +++ head/usr.sbin/bluetooth/hccontrol/le.c Thu May 28 13:48:33 2020 (r361586) @@ -1078,7 +1078,7 @@ static void handle_le_connection_event(ng_hci_event_pk "Supervision timeout: %dms\n", 10 * le16toh(conn_event->supervision_timeout)); fprintf(stdout, - "Master clock accuracy: %sn", + "Master clock accuracy: %s\n", hci_mc_accuracy2str( conn_event->master_clock_accuracy)); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r361520 - head/usr.sbin/bluetooth/hccontrol
Author: takawata Date: Tue May 26 15:46:18 2020 New Revision: 361520 URL: https://svnweb.freebsd.org/changeset/base/361520 Log: Add le_connect command to connect to an LE device. PR:246664 Submitted by:MarcVeldman Modified: head/usr.sbin/bluetooth/hccontrol/hccontrol.8 head/usr.sbin/bluetooth/hccontrol/hccontrol.h head/usr.sbin/bluetooth/hccontrol/le.c head/usr.sbin/bluetooth/hccontrol/util.c Modified: head/usr.sbin/bluetooth/hccontrol/hccontrol.8 == --- head/usr.sbin/bluetooth/hccontrol/hccontrol.8 Tue May 26 15:45:54 2020(r361519) +++ head/usr.sbin/bluetooth/hccontrol/hccontrol.8 Tue May 26 15:46:18 2020(r361520) @@ -161,6 +161,7 @@ are: .It Cm LE_Clear_White_List .It Cm LE_Add_Device_To_White_List .It Cm LE_Remove_Device_From_White_List +.It Cm LE_Connect .El .Pp The currently supported node commands in Modified: head/usr.sbin/bluetooth/hccontrol/hccontrol.h == --- head/usr.sbin/bluetooth/hccontrol/hccontrol.h Tue May 26 15:45:54 2020(r361519) +++ head/usr.sbin/bluetooth/hccontrol/hccontrol.h Tue May 26 15:46:18 2020(r361520) @@ -80,6 +80,8 @@ char const * hci_con_state2str (int); char const * hci_status2str (int); char const * hci_bdaddr2str (bdaddr_t const *); char const * hci_addrtype2str(int type); +char const *hci_role2str(int role); +char const *hci_mc_accuracy2str (int accuracy); void dump_adv_data(int len, uint8_t* advdata); void print_adv_data(int len, uint8_t* advdata); Modified: head/usr.sbin/bluetooth/hccontrol/le.c == --- head/usr.sbin/bluetooth/hccontrol/le.c Tue May 26 15:45:54 2020 (r361519) +++ head/usr.sbin/bluetooth/hccontrol/le.c Tue May 26 15:46:18 2020 (r361520) @@ -67,6 +67,8 @@ static int le_read_white_list_size(int s, int argc, ch static int le_clear_white_list(int s, int argc, char *argv[]); static int le_add_device_to_white_list(int s, int argc, char *argv[]); static int le_remove_device_from_white_list(int s, int argc, char *argv[]); +static int le_connect(int s, int argc, char *argv[]); +static void handle_le_connection_event(ng_hci_event_pkt_t* e, bool verbose); static int le_set_scan_param(int s, int argc, char *argv[]) @@ -933,6 +935,157 @@ le_remove_device_from_white_list(int s, int argc, char return (OK); } +static int +le_connect(int s, int argc, char *argv[]) +{ + ng_hci_le_create_connection_cp cp; + ng_hci_status_rp rp; + charb[512]; + ng_hci_event_pkt_t *e = (ng_hci_event_pkt_t *) b; + + int n, scancount, bufsize; + char ch; + bool addr_set = false; + bool verbose = false; + + optreset = 1; + optind = 0; + + /* minimal scan interval (2.5ms) */ + cp.scan_interval = htole16(4); + cp.scan_window = htole16(4); + + /* Don't use the whitelist */ + cp.filter_policy = 0x00; + + /* Default to public peer address */ + cp.peer_addr_type = 0x00; + + /* Own address type public */ + cp.own_address_type = 0x00; + + /* 18.75ms min connection interval */ + cp.conn_interval_min = htole16(0x000F); + /* 18.75ms max connection interval */ + cp.conn_interval_max = htole16(0x000F); + + /* 0 events connection latency */ + cp.conn_latency = htole16(0x); + + /* 32s supervision timeout */ + cp.supervision_timeout = htole16(0x0C80); + + /* Min CE Length 0.625 ms */ + cp.min_ce_length = htole16(1); + /* Max CE Length 0.625 ms */ + cp.max_ce_length = htole16(1); + + while ((ch = getopt(argc, argv , "a:t:v")) != -1) { + switch(ch) { + case 't': + if (strcmp(optarg, "public") == 0) + cp.peer_addr_type = 0x00; + else if (strcmp(optarg, "random") == 0) + cp.peer_addr_type = 0x01; + else + return (USAGE); + break; + case 'a': + addr_set = true; + if (!bt_aton(optarg, &cp.peer_addr)) { + struct hostent *he = NULL; + + if ((he = bt_gethostbyname(optarg)) == NULL) + return (USAGE); + + memcpy(&cp.peer_addr, he->h_addr, + sizeof(cp.peer_addr)); + } + break; + case 'v': + verbose = true; + break; + } + } + + if (addr_set == false) +
svn commit: r361254 - head/sys/netgraph/bluetooth/include
Author: takawata Date: Tue May 19 13:58:52 2020 New Revision: 361254 URL: https://svnweb.freebsd.org/changeset/base/361254 Log: Fix Typo in ng_hci_le_connection_complete_ep struct. PR: 246538 Submitted by: Marc Veldman Modified: head/sys/netgraph/bluetooth/include/ng_hci.h Modified: head/sys/netgraph/bluetooth/include/ng_hci.h == --- head/sys/netgraph/bluetooth/include/ng_hci.hTue May 19 13:54:33 2020(r361253) +++ head/sys/netgraph/bluetooth/include/ng_hci.hTue May 19 13:58:52 2020(r361254) @@ -1964,7 +1964,7 @@ typedef struct { u_int16_t interval; u_int8_tlatency; u_int16_t supervision_timeout; - u_int8_tmaster_clock_accracy; + u_int8_tmaster_clock_accuracy; } __attribute__ ((packed)) ng_hci_le_connection_complete_ep; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r361251 - head/usr.sbin/bluetooth/hccontrol
Author: takawata Date: Tue May 19 13:44:32 2020 New Revision: 361251 URL: https://svnweb.freebsd.org/changeset/base/361251 Log: Add LE Whitelist commands to hccontrol PR: 214555 Submitted by Marc Veldman Modified: head/usr.sbin/bluetooth/hccontrol/hccontrol.8 head/usr.sbin/bluetooth/hccontrol/le.c Modified: head/usr.sbin/bluetooth/hccontrol/hccontrol.8 == --- head/usr.sbin/bluetooth/hccontrol/hccontrol.8 Tue May 19 12:16:44 2020(r361250) +++ head/usr.sbin/bluetooth/hccontrol/hccontrol.8 Tue May 19 13:44:32 2020(r361251) @@ -157,6 +157,10 @@ are: .It Cm LE_Read_Supported_States .It Cm LE_Read_Buffer_Size .It Cm LE Scan +.It Cm LE_Read_White_List_Size +.It Cm LE_Clear_White_List +.It Cm LE_Add_Device_To_White_List +.It Cm LE_Remove_Device_From_White_List .El .Pp The currently supported node commands in Modified: head/usr.sbin/bluetooth/hccontrol/le.c == --- head/usr.sbin/bluetooth/hccontrol/le.c Tue May 19 12:16:44 2020 (r361250) +++ head/usr.sbin/bluetooth/hccontrol/le.c Tue May 19 13:44:32 2020 (r361251) @@ -63,6 +63,10 @@ static int le_set_advertising_param(int s, int argc, c static int le_read_advertising_channel_tx_power(int s, int argc, char *argv[]); static int le_scan(int s, int argc, char *argv[]); static void handle_le_event(ng_hci_event_pkt_t* e, bool verbose); +static int le_read_white_list_size(int s, int argc, char *argv[]); +static int le_clear_white_list(int s, int argc, char *argv[]); +static int le_add_device_to_white_list(int s, int argc, char *argv[]); +static int le_remove_device_from_white_list(int s, int argc, char *argv[]); static int le_set_scan_param(int s, int argc, char *argv[]) @@ -762,6 +766,173 @@ static void handle_le_event(ng_hci_event_pkt_t* e, boo } } +static int +le_read_white_list_size(int s, int argc, char *argv[]) +{ + ng_hci_le_read_white_list_size_rp rp; + int n; + + n = sizeof(rp); + + if (hci_simple_request(s, NG_HCI_OPCODE(NG_HCI_OGF_LE, + NG_HCI_OCF_LE_READ_WHITE_LIST_SIZE), + (void *)&rp, &n) == ERROR) + return (ERROR); + + if (rp.status != 0x00) { + fprintf(stdout, "Status: %s [%#02x]\n", + hci_status2str(rp.status), rp.status); + return (FAILED); + } + +fprintf(stdout, "White list size: %d\n", + (uint8_t)rp.white_list_size); + + return (OK); +} + +static int +le_clear_white_list(int s, int argc, char *argv[]) +{ + ng_hci_le_clear_white_list_rp rp; + int n; + + n = sizeof(rp); + + if (hci_simple_request(s, NG_HCI_OPCODE(NG_HCI_OGF_LE, + NG_HCI_OCF_LE_CLEAR_WHITE_LIST), + (void *)&rp, &n) == ERROR) + return (ERROR); + + if (rp.status != 0x00) { + fprintf(stdout, "Status: %s [%#02x]\n", + hci_status2str(rp.status), rp.status); + return (FAILED); + } + +fprintf(stdout, "White list cleared\n"); + + return (OK); +} + +static int +le_add_device_to_white_list(int s, int argc, char *argv[]) +{ + ng_hci_le_add_device_to_white_list_cp cp; + ng_hci_le_add_device_to_white_list_rp rp; + int n; + char ch; + optreset = 1; + optind = 0; + bool addr_set = false; + + n = sizeof(rp); + + cp.address_type = 0x00; + + while ((ch = getopt(argc, argv , "t:a:")) != -1) { + switch(ch) { + case 't': + if (strcmp(optarg, "public") == 0) + cp.address_type = 0x00; + else if (strcmp(optarg, "random") == 0) + cp.address_type = 0x01; + else + return (USAGE); + break; + case 'a': + addr_set = true; + if (!bt_aton(optarg, &cp.address)) { + struct hostent *he = NULL; + + if ((he = bt_gethostbyname(optarg)) == NULL) + return (USAGE); + + memcpy(&cp.address, he->h_addr, + sizeof(cp.address)); + } + break; + } + } + + if (addr_set == false) + return (USAGE); + + if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_LE, + NG_HCI_OCF_LE_ADD_DEVICE_TO_WHITE_LIST), + (void *)&cp, sizeof(cp), (void *)&rp, &n) == ERROR) + return (ERROR); + + if (rp.status != 0x00) { + fprint
svn commit: r360899 - head/usr.sbin/bluetooth/hccontrol
Author: takawata Date: Mon May 11 15:32:32 2020 New Revision: 360899 URL: https://svnweb.freebsd.org/changeset/base/360899 Log: Add le_scan subcommand to hccontrol. PR: 246141 Submitted by: Marc Veldman Added: head/usr.sbin/bluetooth/hccontrol/adv_data.c (contents, props changed) Modified: head/usr.sbin/bluetooth/hccontrol/Makefile head/usr.sbin/bluetooth/hccontrol/hccontrol.8 head/usr.sbin/bluetooth/hccontrol/hccontrol.h head/usr.sbin/bluetooth/hccontrol/le.c head/usr.sbin/bluetooth/hccontrol/node.c head/usr.sbin/bluetooth/hccontrol/util.c Modified: head/usr.sbin/bluetooth/hccontrol/Makefile == --- head/usr.sbin/bluetooth/hccontrol/Makefile Mon May 11 15:21:03 2020 (r360898) +++ head/usr.sbin/bluetooth/hccontrol/Makefile Mon May 11 15:32:32 2020 (r360899) @@ -8,7 +8,7 @@ PROG= hccontrol MAN= hccontrol.8 SRCS= send_recv.c link_policy.c link_control.c le.c\ host_controller_baseband.c info.c status.c node.c hccontrol.c \ - util.c + util.c adv_data.c WARNS?=2 LIBADD=bluetooth Added: head/usr.sbin/bluetooth/hccontrol/adv_data.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bluetooth/hccontrol/adv_data.cMon May 11 15:32:32 2020(r360899) @@ -0,0 +1,249 @@ +/*- + * adv_data.c + * + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + + * Copyright (c) 2020 Marc Veldman + * 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. + * + * $Id$ + * $FreeBSD$ + */ + +#include +#include +#include +#include +#define L2CAP_SOCKET_CHECKED +#include +#include "hccontrol.h" + +static char* const adv_data2str(int len, uint8_t* data, char* buffer, + int size); +static char* const adv_name2str(int len, uint8_t* advdata, char* buffer, + int size); +static char* const adv_uuid2str(int datalen, uint8_t* data, char* buffer, + int size); + +void dump_adv_data(int len, uint8_t* advdata) +{ + int n=0; + fprintf(stdout, "\tADV Data: "); + for (n = 0; n < len+1; n++) { + fprintf(stdout, "%02x ", advdata[n]); + } + fprintf(stdout, "\n"); +} + +void print_adv_data(int len, uint8_t* advdata) +{ + int n=0; + while(n < len) + { + char buffer[2048]; + uint8_t datalen = advdata[n]; + uint8_t datatype = advdata[++n]; + /* Skip type */ + ++n; + datalen--; + switch (datatype) { + case 0x01: + fprintf(stdout, + "\tFlags: %s\n", + adv_data2str( + datalen, + &advdata[n], + buffer, + sizeof(buffer))); + break; + case 0x02: + fprintf(stdout, + "\tIncomplete list of service" + " class UUIDs (16-bit): %s\n", + adv_data2str( + datalen, + &advdata[n], + buffer, + sizeof(buffer))); +
svn commit: r360846 - head/sys/netgraph/bluetooth/include
Author: takawata Date: Sat May 9 14:15:44 2020 New Revision: 360846 URL: https://svnweb.freebsd.org/changeset/base/360846 Log: Add space for RSSI in data member. RSSI is put just after actual data. Submitted by: Marc Veldman PR: 245920 Modified: head/sys/netgraph/bluetooth/include/ng_hci.h Modified: head/sys/netgraph/bluetooth/include/ng_hci.h == --- head/sys/netgraph/bluetooth/include/ng_hci.hSat May 9 13:00:38 2020(r360845) +++ head/sys/netgraph/bluetooth/include/ng_hci.hSat May 9 14:15:44 2020(r360846) @@ -1980,7 +1980,8 @@ typedef struct { u_int8_t addr_type; bdaddr_t bdaddr; u_int8_t length_data; - u_int8_t data[NG_HCI_SCAN_RESPONSE_DATA_MAX]; + /* The last octet is for RSSI */ + u_int8_t data[NG_HCI_SCAN_RESPONSE_DATA_MAX+1]; }__attribute__((packed)) ng_hci_le_advreport; #define NG_HCI_LEEV_CON_UPDATE_COMPL 0x03 ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r360806 - head/usr.sbin/bluetooth/hccontrol
Author: takawata Date: Fri May 8 01:19:29 2020 New Revision: 360806 URL: https://svnweb.freebsd.org/changeset/base/360806 Log: Document le_enable subcommand Modified: head/usr.sbin/bluetooth/hccontrol/hccontrol.8 Modified: head/usr.sbin/bluetooth/hccontrol/hccontrol.8 == --- head/usr.sbin/bluetooth/hccontrol/hccontrol.8 Fri May 8 00:04:25 2020(r360805) +++ head/usr.sbin/bluetooth/hccontrol/hccontrol.8 Fri May 8 01:19:29 2020(r360806) @@ -145,6 +145,7 @@ are: .It Cm Reset_Failed_Contact_Counter .It Cm Get_Link_Quality .It Cm Read_RSSI +.It Cm LE_Enable .It Cm LE_Read_Local_Supported_Features .It Cm LE_Set_Advertising_Parameters .It Cm LE_Read_Advertising_Physical_Channel_Tx_Power ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r360440 - in head: sys/netgraph/bluetooth/include usr.sbin/bluetooth/hccontrol
Author: takawata Date: Tue Apr 28 16:00:34 2020 New Revision: 360440 URL: https://svnweb.freebsd.org/changeset/base/360440 Log: Add le_read_buffer_size command and manpage. It supports both v1 and v2 command. PR:245964 Submitted by: Marc Veldman Modified: head/sys/netgraph/bluetooth/include/ng_hci.h head/usr.sbin/bluetooth/hccontrol/hccontrol.8 head/usr.sbin/bluetooth/hccontrol/le.c Modified: head/sys/netgraph/bluetooth/include/ng_hci.h == --- head/sys/netgraph/bluetooth/include/ng_hci.hTue Apr 28 15:44:39 2020(r360439) +++ head/sys/netgraph/bluetooth/include/ng_hci.hTue Apr 28 16:00:34 2020(r360440) @@ -1672,6 +1672,15 @@ typedef struct { u_int16_t connection_handle; }__attribute__ ((packed)) ng_hci_le_long_term_key_request_negative_reply_rp; +#define NG_HCI_OCF_LE_READ_BUFFER_SIZE_V2 0x0060 +/*No command parameter */ +typedef struct { + u_int8_tstatus; + u_int16_t hc_le_data_packet_length; + u_int8_thc_total_num_le_data_packets; + u_int16_t hc_iso_data_packet_length; + u_int8_thc_total_num_iso_data_packets; +} __attribute__ ((packed)) ng_hci_le_read_buffer_size_rp_v2; #define NG_HCI_OCF_LE_READ_SUPPORTED_STATES0x001c /*No command parameter*/ Modified: head/usr.sbin/bluetooth/hccontrol/hccontrol.8 == --- head/usr.sbin/bluetooth/hccontrol/hccontrol.8 Tue Apr 28 15:44:39 2020(r360439) +++ head/usr.sbin/bluetooth/hccontrol/hccontrol.8 Tue Apr 28 16:00:34 2020(r360440) @@ -25,7 +25,7 @@ .\" $Id: hccontrol.8,v 1.6 2003/08/06 21:26:38 max Exp $ .\" $FreeBSD$ .\" -.Dd April 24, 2020 +.Dd April 27, 2020 .Dt HCCONTROL 8 .Os .Sh NAME @@ -154,6 +154,7 @@ are: .It Cm LE_Set_Scan_Parameters .It Cm LE_Set_Scan_Enable .It Cm LE_Read_Supported_States +.It Cm LE_Read_Buffer_Size .El .Pp The currently supported node commands in Modified: head/usr.sbin/bluetooth/hccontrol/le.c == --- head/usr.sbin/bluetooth/hccontrol/le.c Tue Apr 28 15:44:39 2020 (r360439) +++ head/usr.sbin/bluetooth/hccontrol/le.c Tue Apr 28 16:00:34 2020 (r360440) @@ -554,7 +554,65 @@ le_set_advertising_data(int s, int argc, char *argv[]) return (OK); } +static int +le_read_buffer_size(int s, int argc, char *argv[]) +{ + union { + ng_hci_le_read_buffer_size_rp v1; + ng_hci_le_read_buffer_size_rp_v2v2; + } rp; + int n, ch; + uint8_t v; + uint16_t cmd; + + optreset = 1; + optind = 0; + + /* Default to version 1*/ + v = 1; + cmd = NG_HCI_OCF_LE_READ_BUFFER_SIZE; + + while ((ch = getopt(argc, argv , "v:")) != -1) { + switch(ch) { + case 'v': + v = (uint8_t)strtol(optarg, NULL, 16); + if (v == 2) + cmd = NG_HCI_OCF_LE_READ_BUFFER_SIZE_V2; + else if (v > 2) + return (USAGE); + break; + default: + v = 1; + } + } + + n = sizeof(rp); + if (hci_simple_request(s, NG_HCI_OPCODE(NG_HCI_OGF_LE, cmd), + (void *)&rp, &n) == ERROR) + return (ERROR); + + if (rp.v1.status != 0x00) { + fprintf(stdout, "Status: %s [%#02x]\n", + hci_status2str(rp.v1.status), rp.v1.status); + return (FAILED); + } + + fprintf(stdout, "ACL data packet length: %d\n", + rp.v1.hc_le_data_packet_length); + fprintf(stdout, "Number of ACL data packets: %d\n", + rp.v1.hc_total_num_le_data_packets); + + if (v == 2) { + fprintf(stdout, "ISO data packet length: %d\n", + rp.v2.hc_iso_data_packet_length); + fprintf(stdout, "Number of ISO data packets: %d\n", + rp.v2.hc_total_num_iso_data_packets); + } + + return (OK); +} + struct hci_command le_commands[] = { { "le_enable", @@ -620,5 +678,11 @@ struct hci_command le_commands[] = { "le_set_advertising_data -n $name -f $flag -u $uuid16,$uuid16 \n" "set LE device advertising packed data", &le_set_advertising_data + }, + { + "le_read_buffer_size", + "le_read_buffer_size [-v 1|2]\n" + "Read the maximum size of ACL and ISO data packets", + &le_read_buffer_size }, }; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any m
svn commit: r360435 - head/usr.sbin/bluetooth/hccontrol
Author: takawata Date: Tue Apr 28 13:28:58 2020 New Revision: 360435 URL: https://svnweb.freebsd.org/changeset/base/360435 Log: Improve error handling Check return values from hci_request() Check rp.status Print error messages with hci_status2str() PR: 245769 Submitted by: Marc Veldman Modified: head/usr.sbin/bluetooth/hccontrol/le.c Modified: head/usr.sbin/bluetooth/hccontrol/le.c == --- head/usr.sbin/bluetooth/hccontrol/le.c Tue Apr 28 13:16:35 2020 (r360434) +++ head/usr.sbin/bluetooth/hccontrol/le.c Tue Apr 28 13:28:58 2020 (r360435) @@ -69,20 +69,20 @@ le_set_scan_param(int s, int argc, char *argv[]) int window; int adrtype; int policy; - int e, n; + int n; ng_hci_le_set_scan_parameters_cp cp; ng_hci_le_set_scan_parameters_rp rp; if (argc != 5) - return USAGE; + return (USAGE); if (strcmp(argv[0], "active") == 0) type = 1; else if (strcmp(argv[0], "passive") == 0) type = 0; else - return USAGE; + return (USAGE); interval = (int)(atof(argv[1])/0.625); interval = (interval < 4)? 4: interval; @@ -94,14 +94,14 @@ le_set_scan_param(int s, int argc, char *argv[]) else if (strcmp(argv[3], "random") == 0) adrtype = 1; else - return USAGE; + return (USAGE); if (strcmp(argv[4], "all") == 0) policy = 0; else if (strcmp(argv[4], "whitelist") == 0) policy = 1; else - return USAGE; + return (USAGE); cp.le_scan_type = type; cp.le_scan_interval = interval; @@ -109,11 +109,19 @@ le_set_scan_param(int s, int argc, char *argv[]) cp.le_scan_window = window; cp.scanning_filter_policy = policy; n = sizeof(rp); - e = hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_LE, + + if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_LE, NG_HCI_OCF_LE_SET_SCAN_PARAMETERS), - (void *)&cp, sizeof(cp), (void *)&rp, &n); + (void *)&cp, sizeof(cp), (void *)&rp, &n) == ERROR) + return (ERROR); - return 0; + if (rp.status != 0x00) { + fprintf(stdout, "Status: %s [%#02x]\n", + hci_status2str(rp.status), rp.status); + return (FAILED); + } + + return (OK); } static int @@ -121,27 +129,35 @@ le_set_scan_enable(int s, int argc, char *argv[]) { ng_hci_le_set_scan_enable_cp cp; ng_hci_le_set_scan_enable_rp rp; - int e, n, enable = 0; + int n, enable = 0; if (argc != 1) - return USAGE; + return (USAGE); if (strcmp(argv[0], "enable") == 0) enable = 1; else if (strcmp(argv[0], "disable") != 0) - return USAGE; + return (USAGE); n = sizeof(rp); cp.le_scan_enable = enable; cp.filter_duplicates = 0; - e = hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_LE, + if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_LE, NG_HCI_OCF_LE_SET_SCAN_ENABLE), - (void *)&cp, sizeof(cp), (void *)&rp, &n); + (void *)&cp, sizeof(cp), + (void *)&rp, &n) == ERROR) + return (ERROR); - if (e != 0 || rp.status != 0) - return ERROR; + if (rp.status != 0x00) { + fprintf(stdout, "Status: %s [%#02x]\n", + hci_status2str(rp.status), rp.status); + return (FAILED); + } - return OK; + fprintf(stdout, "LE Scan: %s\n", + enable? "Enabled" : "Disabled"); + + return (OK); } static int @@ -197,7 +213,7 @@ parse_param(int argc, char *argv[], char *buf, int *le done: *len = curbuf - buf; - return OK; + return (OK); } static int @@ -206,7 +222,6 @@ le_set_scan_response(int s, int argc, char *argv[]) ng_hci_le_set_scan_response_data_cp cp; ng_hci_le_set_scan_response_data_rp rp; int n; - int e; int len; char buf[NG_HCI_ADVERTISING_DATA_SIZE]; @@ -216,13 +231,19 @@ le_set_scan_response(int s, int argc, char *argv[]) cp.scan_response_data_length = len; memcpy(cp.scan_response_data, buf, len); n = sizeof(rp); - e = hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_LE, + if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_LE, NG_HCI_OCF_LE_SET_SCAN_RESPONSE_DATA), - (void *)&cp, sizeof(cp), (void *)&rp, &n); + (void *)&cp, sizeof(cp), + (void *)&rp, &n) == ERROR) + return (ERROR);
svn commit: r360369 - head/usr.sbin/bluetooth/hccontrol
Author: takawata Date: Mon Apr 27 09:13:22 2020 New Revision: 360369 URL: https://svnweb.freebsd.org/changeset/base/360369 Log: Resolve vendor id to string. Modified: head/usr.sbin/bluetooth/hccontrol/node.c Modified: head/usr.sbin/bluetooth/hccontrol/node.c == --- head/usr.sbin/bluetooth/hccontrol/node.cMon Apr 27 05:35:26 2020 (r360368) +++ head/usr.sbin/bluetooth/hccontrol/node.cMon Apr 27 09:13:22 2020 (r360369) @@ -267,7 +267,8 @@ static int hci_dump_adv(uint8_t *data, int length) case 0xff: if (elemlen < 2) break; - printf("Vendor:%04x:", data[0]|data[1]<<8); + printf("Vendor:%s:", + hci_manufacturer2str(data[0]|data[1]<<8)); for (i = 2; i < MIN(length,elemlen); i++) { printf("%02x ",data[i]); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r360360 - head/usr.sbin/bluetooth/hccontrol
Author: takawata Date: Mon Apr 27 02:48:49 2020 New Revision: 360360 URL: https://svnweb.freebsd.org/changeset/base/360360 Log: Fix advertise packet parsing. Differential Revision:https://reviews.freebsd.org/D21779 Modified: head/usr.sbin/bluetooth/hccontrol/node.c Modified: head/usr.sbin/bluetooth/hccontrol/node.c == --- head/usr.sbin/bluetooth/hccontrol/node.cMon Apr 27 02:01:48 2020 (r360359) +++ head/usr.sbin/bluetooth/hccontrol/node.cMon Apr 27 02:48:49 2020 (r360360) @@ -40,6 +40,7 @@ #include #include #include +#include #include "hccontrol.h" /* Send Read_Node_State command to the node */ @@ -222,23 +223,53 @@ static int hci_dump_adv(uint8_t *data, int length) elemlen = *data; data++; length --; - elemlen--; if(length<=0) break; type = *data; data++; length --; elemlen--; - if(length<=0) + if(length <= 0) break; switch(type){ case 0x1: printf("NDflag:%x\n", *data); break; + case 0x8: case 0x9: printf("LocalName:"); for(i = 0; i < MIN(length,elemlen); i++){ putchar(data[i]); + } + printf("\n"); + break; + case 0x6: + case 0x7: + { + uuid_t uuid; + char *uuidstr; + uint32_t ustatus; + if (elemlen < 16) + break; + uuid.time_low = le32dec(data+12); + uuid.time_mid = le16dec(data+10); + uuid.time_hi_and_version = le16dec(data+8); + uuid.clock_seq_hi_and_reserved = data[7]; + uuid.clock_seq_low = data[6]; + for(i = 0; i < _UUID_NODE_LEN; i++){ + uuid.node[i] = data[5 - i]; + } + uuid_to_string(&uuid, &uuidstr, &ustatus); + + printf("ServiceUUID: %s\n", uuidstr); + break; + } + case 0xff: + if (elemlen < 2) + break; + printf("Vendor:%04x:", data[0]|data[1]<<8); + for (i = 2; i < MIN(length,elemlen); i++) { + printf("%02x ",data[i]); } printf("\n"); break; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r359560 - head/sys/netgraph/bluetooth/hci
Author: takawata Date: Thu Apr 2 09:15:31 2020 New Revision: 359560 URL: https://svnweb.freebsd.org/changeset/base/359560 Log: Fix mbuf handling in le advertize packet processing. Submitted by: Marc Veldman Modified: head/sys/netgraph/bluetooth/hci/ng_hci_evnt.c Modified: head/sys/netgraph/bluetooth/hci/ng_hci_evnt.c == --- head/sys/netgraph/bluetooth/hci/ng_hci_evnt.c Thu Apr 2 07:42:29 2020(r359559) +++ head/sys/netgraph/bluetooth/hci/ng_hci_evnt.c Thu Apr 2 09:15:31 2020(r359560) @@ -381,17 +381,20 @@ le_advertizing_report(ng_hci_unit_p unit, struct mbuf ng_hci_neighbor_pn = NULL; bdaddr_t bdaddr; int error = 0; + int num_reports = 0; u_int8_t event_type; u_int8_t addr_type; - + NG_HCI_M_PULLUP(event, sizeof(*ep)); if (event == NULL) return (ENOBUFS); ep = mtod(event, ng_hci_le_advertising_report_ep *); + num_reports = ep->num_reports; m_adj(event, sizeof(*ep)); - - for (; ep->num_reports > 0; ep->num_reports --) { + ep = NULL; + + for (; num_reports > 0; num_reports --) { /* Get remote unit address */ NG_HCI_M_PULLUP(event, sizeof(u_int8_t)); event_type = *mtod(event, u_int8_t *); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r359479 - in head: share/man/man4 sys/dev/intel sys/modules sys/modules/pchtherm
Author: takawata Date: Tue Mar 31 06:25:43 2020 New Revision: 359479 URL: https://svnweb.freebsd.org/changeset/base/359479 Log: Add Platform Controller Hub built-in thermal management device driver. Differential Revision:https://reviews.freebsd.org/D24077 Added: head/share/man/man4/pchtherm.4 (contents, props changed) head/sys/dev/intel/pchtherm.c (contents, props changed) head/sys/modules/pchtherm/ head/sys/modules/pchtherm/Makefile (contents, props changed) Modified: head/share/man/man4/Makefile head/sys/modules/Makefile Modified: head/share/man/man4/Makefile == --- head/share/man/man4/MakefileTue Mar 31 02:36:39 2020 (r359478) +++ head/share/man/man4/MakefileTue Mar 31 06:25:43 2020 (r359479) @@ -404,6 +404,7 @@ MAN=aac.4 \ pccard.4 \ pccbb.4 \ pcf.4 \ + ${_pchtherm.4} \ pci.4 \ pcib.4 \ pcic.4 \ @@ -815,6 +816,7 @@ _nvd.4= nvd.4 _nvme.4= nvme.4 _nvram.4= nvram.4 _padlock.4=padlock.4 +_pchtherm.4= pchtherm.4 _rr232x.4= rr232x.4 _speaker.4=speaker.4 _spkr.4= spkr.4 Added: head/share/man/man4/pchtherm.4 == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/pchtherm.4 Tue Mar 31 06:25:43 2020 (r359479) @@ -0,0 +1,117 @@ +.\" +.\" Copyright (c) 2020 Takanori Watanabe +.\" +.\" 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$ +.\" +.Dd March 15, 2020 +.Dt pchtherm 4 +.Os +.Sh NAME +.Nm pchtherm +.Nd Intel PCH thermal subsystem +.Sh SYNOPSIS +.Cd "device pci" +.Cd "device pchtherm" +.Sh DESCRIPTION +The +.Nm +driver provides access to sensor data and configuration +installed in Intel PCH chipset. +.Nm +configuration register. +.Pp +The access to +.Nm +data is made via the +.Xr sysctl 8 +interface: +.Bd -literal +dev.pchtherm.0.ctt: 115.0C +dev.pchtherm.0.temperature: 28.5C +dev.pchtherm.0.t2temp: 91.0C +dev.pchtherm.0.t1temp: 86.0C +dev.pchtherm.0.t0temp: 81.0C +dev.pchtherm.0.tahv: 83.0C +dev.pchtherm.0.talv: 30.0C +dev.pchtherm.0.pmtime: 32 +dev.pchtherm.0.pmtemp: 50.0C +dev.pchtherm.0.%parent: pci0 +dev.pchtherm.0.%pnpinfo: vendor=0x8086 device=0x9d31 subvendor=0x17aa subdevice=0x2256 class=0x118000 +dev.pchtherm.0.%location: slot=20 function=2 dbsf=pci0:0:20:2 +dev.pchtherm.0.%driver: pchtherm +dev.pchtherm.0.%desc: Skylake PCH Thermal Subsystem +dev.pchtherm.%parent: +.Ed +.Bl -tag -width ".Va dev.pchtherm.%d.pch_hot_level" +.It Va dev.pchtherm.%d.temperature +Is the read-only value of the current temperature read by the sensor. +.It Va dev.pchtherm.%d.ctt +When the system reaches this temperature, it will shut down. +This will not appear when this feature is disabled and locked down. +.It Va dev.pchtherm.%d.t0temp +When temperature is under this value, system will be in T0 state. +.It Va dev.pchtherm.%d.t1temp +When temperature is over +.Va t0temp +and under this value, system will be in T1 state. +.It Va dev.pchtherm.%d.t2temp +When temperature is over +.Va t1temp +and under this value, system will be in T2 state. +Over this value, system will be in T3 state. +.It Va dev.pchtherm.%d.talv +Lower alart value. +This will not appear when sensor enable bit is locked down and the value is zero(which will show -50.0C). +.It Va dev.pchtherm.%d.tahv +High alart value. +This will not appear when sensor enable bit is locked down and t
svn commit: r355574 - head/share/man/man4
Author: takawata Date: Tue Dec 10 02:19:07 2019 New Revision: 355574 URL: https://svnweb.freebsd.org/changeset/base/355574 Log: Add ACPI battery subsystem man page. PR:242100 Differential Revision:https://reviews.freebsd.org/D22556 Added: head/share/man/man4/acpi_battery.4 (contents, props changed) Modified: head/share/man/man4/Makefile Modified: head/share/man/man4/Makefile == --- head/share/man/man4/MakefileTue Dec 10 00:08:05 2019 (r355573) +++ head/share/man/man4/MakefileTue Dec 10 02:19:07 2019 (r355574) @@ -16,6 +16,7 @@ MAN= aac.4 \ ${_acpi_rapidstart.4} \ ${_acpi_sony.4} \ acpi_thermal.4 \ + acpi_battery.4 \ ${_acpi_toshiba.4} \ acpi_video.4 \ ${_acpi_wmi.4} \ Added: head/share/man/man4/acpi_battery.4 == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/acpi_battery.4 Tue Dec 10 02:19:07 2019 (r355574) @@ -0,0 +1,283 @@ +.\" +.\" Copyright (c) 2019 Takanori Watanabe +.\" 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$ +.\" +.Dd November 26, 2019 +.Dt ACPI_BATTERY 4 +.Os +.Sh NAME +.Nm acpi_battery +.Nd ACPI battery management subsystem +.Sh SYNOPSIS +.Cd "device acpi" +.Sh DESCRIPTION +The +.Nm +is a driver for battery management features of the ACPI module. +An ACPI-compatible battery device supports either a Control +Method Battery interface or a Smart Battery subsystem interface. +The former is accessed by the AML +.Pq ACPI Machine Language +code control methods, +and the latter is controlled directly through the ACPI EC +.Pq Embedded Controller +typically via an SMBus interface. +This driver supports the +.Xr sysctl 8 +and +.Xr ioctl 2 +interfaces as well as the +.Xr devd 8 +event notification interface. +.Sh IOCTLS +Every ioctl for the +.Nm +driver takes a single integer value for the battery unit +number as an argument, +and returns a specific structure for each request. +A special unit number +.Li ACPI_BATTERY_ALL_UNITS +specifies all of the attached units +and reports accumulated information. +.Bl -tag -width indent +.It ACPIIO_BATT_GET_UNITS Vt int +Returns the number of battery units in the system. +The unit number argument will be ignored. +.It ACPIIO_BATT_GET_BATTINFO Vt struct acpi_battinfo +Returns the following: +.Bl -tag -width indent +.It cap +Battery capacity in percent, +.It min +Remaining battery life in minutes, +.It state +Current status of the battery encoded in the following: +.Bl -tag -width indent +.It ACPI_BATT_STAT_DISCHARG Pq 0x0001 +Battery is discharging, +.It ACPI_BATT_STAT_CHARGING Pq 0x0002 +Battery is being charged, or +.It ACPI_BATT_STAT_CRITICAL Pq 0x0004 +Remaining battery life is critically low. +.El +.Pp +Note that the status bits of each battery will be +consolidated when +.Li ACPI_BATTERY_ALL_UNITS +is specified. +.It rate +Current battery discharging rate in mW. +.Li -1 +means not discharging right now. +.El +.It ACPIIO_BATT_GET_BIF Vt struct acpi_bif +Returns battery information given by the ACPI +.Li _BIF Pq Battery Information +object, +which is the static portion of the Control Method +Battery information. +In the case of a Smart Battery attached to SMBus, +this ioctl will build a +.Vt struct acpi_bif +structure based on the obtained information +and return it. +.Bl -tag -widt
svn commit: r351930 - in head: share/man/man4 sys/dev/acpi_support
Author: takawata Date: Fri Sep 6 10:12:05 2019 New Revision: 351930 URL: https://svnweb.freebsd.org/changeset/base/351930 Log: Add embedded Managed Object Format blob access to acpi_wmi(4). This blob is can be converted to human readable form by bmfdec. (http://github.com/pali/bmfdec) Differential Revision:https://reviews.freebsd.org/D21529 Modified: head/share/man/man4/acpi_wmi.4 head/sys/dev/acpi_support/acpi_wmi.c Modified: head/share/man/man4/acpi_wmi.4 == --- head/share/man/man4/acpi_wmi.4 Fri Sep 6 08:08:33 2019 (r351929) +++ head/share/man/man4/acpi_wmi.4 Fri Sep 6 10:12:05 2019 (r351930) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 22, 2011 +.Dd Sep 5, 2019 .Dt ACPI_WMI 4 .Os .Sh NAME @@ -56,6 +56,15 @@ information about GUIDs found in the system. .It Pa /dev/wmistat%d WMI status device. .El +.Sh SYSCTLS +The following sysctl node is currently implemented: +.Bl -tag +.It Va dev.acpi_wmi.%d.bmof +Managed Object Format (MOF) blob. +You can obtain human readable output by bmf2mof in bmfdec tool. +(https://github.com/pali/bmfdec) +.El + .Sh EXAMPLES .Bd -literal # cat /dev/wmistat0 @@ -72,6 +81,20 @@ GUID INST EXPE METH S {8232DE3D-663D-4327-A8F4-E293ADB9BF05} 0 NO NO NO NOBG {8F1F6436-9F42-42C8-BADC-0E9424F20C9A} 0 NO NO NO NOBH {8F1F6435-9F42-42C8-BADC-0E9424F20C9A} 0 NO NO NO NOBI +# sysctl -b dev.acpi_wmi.0.bmof |bmf2mof +[abstract] +class Lenovo_BIOSElement { +}; + +[WMI, Dynamic, Provider("WMIProv"), WmiExpense(1), Description("Bios Setting"), +GUID("{51F5230E-9677-46cd-A1CF-C0B23EE34DB7}"), Locale("MS\\0x409")] +class Lenovo_BiosSetting : Lenovo_BiosElement { + [key, read] String InstanceName; +[read] Boolean Active; + [WmiDataId(1), Description("BIOS setting")] String CurrentSetting; + }; + ... + .Ed .Sh SEE ALSO .Xr acpi 4 @@ -91,6 +114,9 @@ Work has been inspired by the Linux acpi-wmi driver wr .Pp See http://www.microsoft.com/whdc/system/pnppwr/wmi/wmi-acpi.mspx for the specification of ACPI-WMI. +.Pp +MOF part has been inspired by the Linux wmi-bmof driver +written by Andy Lutomirski. .Pp This manual page was written by .An Michael Gmelin Aq Mt free...@grem.de . Modified: head/sys/dev/acpi_support/acpi_wmi.c == --- head/sys/dev/acpi_support/acpi_wmi.cFri Sep 6 08:08:33 2019 (r351929) +++ head/sys/dev/acpi_support/acpi_wmi.cFri Sep 6 10:12:05 2019 (r351930) @@ -62,6 +62,7 @@ ACPI_MODULE_NAME("ACPI_WMI"); #define ACPI_WMI_REGFLAG_METHOD0x2 /* GUID flag: Method call */ #define ACPI_WMI_REGFLAG_STRING0x4 /* GUID flag: String */ #define ACPI_WMI_REGFLAG_EVENT 0x8 /* GUID flag: Event */ +#define ACPI_WMI_BMOF_UUID "05901221-D566-11D1-B2F0-00A0C9062910" /* * acpi_wmi driver private structure @@ -74,6 +75,8 @@ struct acpi_wmi_softc { struct sbuf wmistat_sbuf; /* sbuf for /dev/wmistat output */ pid_t wmistat_open_pid; /* pid operating on /dev/wmistat */ int wmistat_bufptr; /* /dev/wmistat ptr to buffer position */ + char*mofbuf; + TAILQ_HEAD(wmi_info_list_head, wmi_info) wmi_info_list; }; @@ -274,6 +277,29 @@ acpi_wmi_attach(device_t dev) } ACPI_SERIAL_END(acpi_wmi); + if (acpi_wmi_provides_guid_string_method(dev, ACPI_WMI_BMOF_UUID)) { + ACPI_BUFFER out = { ACPI_ALLOCATE_BUFFER, NULL }; + ACPI_OBJECT *obj; + + device_printf(dev, "Embedded MOF found\n"); + status = acpi_wmi_get_block_method(dev, ACPI_WMI_BMOF_UUID, + 0, &out); + if (ACPI_SUCCESS(status)) { + obj = out.Pointer; + if (obj && obj->Type == ACPI_TYPE_BUFFER) { + SYSCTL_ADD_OPAQUE(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN( + device_get_sysctl_tree(dev)), + OID_AUTO, "bmof", + CTLFLAG_RD | CTLFLAG_MPSAFE, + obj->Buffer.Pointer, + obj->Buffer.Length, + "A", "MOF Blob"); + } + } + sc->mofbuf = out.Pointer; + } + if (ret == 0) { bus_generic_probe(dev); ret = bus_generic_attach(dev); @@ -321,6 +347,7 @@ acpi_wmi_detach(device_t dev) sc->wmistat_open_pid = 0; destroy_dev(sc->wmistat_dev_t); ret = 0; + AcpiOsFree(sc->mofbuf); } ACPI_SE
svn commit: r350558 - head/sys/dev/usb
Author: takawata Date: Sat Aug 3 16:13:44 2019 New Revision: 350558 URL: https://svnweb.freebsd.org/changeset/base/350558 Log: Add per hub sysctl to expose port information for phyisical form etc. Reviewed by:hselasky Differential Revision:https://reviews.freebsd.org/D20865 Modified: head/sys/dev/usb/usb_hub_acpi.c Modified: head/sys/dev/usb/usb_hub_acpi.c == --- head/sys/dev/usb/usb_hub_acpi.c Sat Aug 3 14:42:07 2019 (r350557) +++ head/sys/dev/usb/usb_hub_acpi.c Sat Aug 3 16:13:44 2019 (r350558) @@ -79,11 +79,22 @@ #include #include #include +#include +#define ACPI_PLD_SIZE 20 +struct acpi_uhub_port { + ACPI_HANDLE handle; +#defineACPI_UPC_CONNECTABLE 0x8000 +#defineACPI_UPC_PORTTYPE(x) ((x)&0xff) + uint32_t upc; + uint8_t pld[ACPI_PLD_SIZE]; +}; + struct acpi_uhub_softc { struct uhub_softc usc; uint8_t nports; - ACPI_HANDLE *porthandle; + ACPI_HANDLE ah; + struct acpi_uhub_port *port; }; static UINT32 @@ -107,51 +118,157 @@ acpi_uhub_find_rh_cb(ACPI_HANDLE ah, UINT32 nl, void * return (ret); } +static const char * +acpi_uhub_upc_type(uint8_t type) +{ + const char *typelist[] = {"TypeA", "MiniAB", "Express", + "USB3-A", "USB3-B", "USB-MicroB", + "USB3-MicroAB", "USB3-PowerB", + "TypeC-USB2", "TypeC-Switch", + "TypeC-nonSwitch"}; + const int last = sizeof(typelist) / sizeof(typelist[0]); + + if (type == 0xff) { + return "Proprietary"; + } + + return (type < last) ? typelist[type] : "Unknown"; +} + static int -acpi_uhub_parse_upc(device_t dev, unsigned int port, ACPI_HANDLE ah) +acpi_uhub_parse_upc(device_t dev, unsigned int p, ACPI_HANDLE ah, struct sysctl_oid_list *poid) { ACPI_BUFFER buf; + struct acpi_uhub_softc *sc = device_get_softc(dev); + struct acpi_uhub_port *port = &sc->port[p - 1]; buf.Pointer = NULL; buf.Length = ACPI_ALLOCATE_BUFFER; if (AcpiEvaluateObject(ah, "_UPC", NULL, &buf) == AE_OK) { - UINT64 porttypenum, conn; - const char *connectable; - const char *typelist[] = { - "TypeA", "MiniAB", "Express", - "USB3-A", "USB3-B", "USB-MicroB", - "USB3-MicroAB", "USB3-PowerB", - "TypeC-USB2", "TypeC-Switch", - "TypeC-nonSwitch" - }; - const char *porttype; - const int last = sizeof(typelist) / sizeof(typelist[0]); ACPI_OBJECT *obj = buf.Pointer; + UINT64 porttypenum, conn; + uint8_t *connectable; acpi_PkgInt(obj, 0, &conn); acpi_PkgInt(obj, 1, &porttypenum); connectable = conn ? "" : "non"; - if (porttypenum == 0xff) - porttype = "Proprietary"; - else if (porttypenum < last) { - porttype = typelist[porttypenum]; - } else { - porttype = "Unknown"; - } + + port->upc = porttypenum; + port->upc |= (conn) ? (ACPI_UPC_CONNECTABLE) : 0; + if (usb_debug) device_printf(dev, "Port %u %sconnectable %s\n", - port, connectable, porttype); + p, connectable, + acpi_uhub_upc_type(porttypenum)); + + SYSCTL_ADD_U32( + device_get_sysctl_ctx(dev), + poid, OID_AUTO, + "upc", + CTLFLAG_RD | CTLFLAG_MPSAFE, + SYSCTL_NULL_U32_PTR, port->upc, + "UPC value. MSB is visible flag"); } AcpiOsFree(buf.Pointer); return (0); } +static int +acpi_uhub_port_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct acpi_uhub_port *port = oidp->oid_arg1; + struct sbuf sb; + int error; + sbuf_new_for_sysctl(&sb, NULL, 256, req); + sbuf_printf(&sb, "Handle %s\n", acpi_name(port->handle)); + if (port->upc == 0x) { + sbuf_printf(&sb, "\tNo information\n"); + goto end; + } + sbuf_printf(&sb, "\t"); + if (port->upc & ACPI_UPC_CONNECTABLE) { + sbuf_printf(&sb, "Connectable "); + } + sbuf_printf(&sb, "%s port\n", acpi_uhub_upc_type(port->upc & 0xff)); + + if ((port->pld[0] & 0x80) == 0) { + sbuf_printf(&sb, + "\tColor:#%02x%02x%02x\n", + port->pld[1], port->pld[2], + port->pld[3]); + } + sbuf_printf(&sb, "\tWidth %d mm Height %d mm\n", +
svn commit: r349251 - head/sys/dev/usb
Author: takawata Date: Thu Jun 20 23:52:33 2019 New Revision: 349251 URL: https://svnweb.freebsd.org/changeset/base/349251 Log: Fix the case where no root hub object while host controller object exist in ACPI namespace. Also you can disable ACPI support for USB by setting debug.acpi.disabled="usb" PR: 238711 Modified: head/sys/dev/usb/usb_hub_acpi.c Modified: head/sys/dev/usb/usb_hub_acpi.c == --- head/sys/dev/usb/usb_hub_acpi.c Thu Jun 20 23:32:25 2019 (r349250) +++ head/sys/dev/usb/usb_hub_acpi.c Thu Jun 20 23:52:33 2019 (r349251) @@ -243,13 +243,14 @@ acpi_uhub_parse_pld(device_t dev, unsigned int port, A } ACPI_STATUS -acpi_uhub_find_rh(device_t dev, ACPI_HANDLE * ah){ +acpi_uhub_find_rh(device_t dev, ACPI_HANDLE * ah) +{ device_t grand; ACPI_HANDLE gah; + *ah = NULL; grand = device_get_parent(device_get_parent(dev)); if ((gah = acpi_get_handle(grand)) == NULL) { - *ah = NULL; return AE_ERROR; } return AcpiWalkNamespace(ACPI_TYPE_DEVICE, gah, 1, @@ -257,7 +258,8 @@ acpi_uhub_find_rh(device_t dev, ACPI_HANDLE * ah){ } ACPI_STATUS -acpi_usb_hub_port_probe_cb(ACPI_HANDLE ah, UINT32 lv, void *ctx, void **rv){ +acpi_usb_hub_port_probe_cb(ACPI_HANDLE ah, UINT32 lv, void *ctx, void **rv) +{ ACPI_DEVICE_INFO *devinfo; device_t dev = ctx; struct acpi_uhub_softc *sc = device_get_softc(dev); @@ -281,7 +283,8 @@ acpi_usb_hub_port_probe_cb(ACPI_HANDLE ah, UINT32 lv, } ACPI_STATUS -acpi_usb_hub_port_probe(device_t dev, ACPI_HANDLE ah){ +acpi_usb_hub_port_probe(device_t dev, ACPI_HANDLE ah) +{ return AcpiWalkNamespace(ACPI_TYPE_DEVICE, ah, 1, acpi_usb_hub_port_probe_cb, @@ -293,6 +296,9 @@ acpi_uhub_root_probe(device_t dev) ACPI_HANDLE ah; ACPI_STATUS status; + if(acpi_disabled("usb")) { + return ENXIO; + } status = acpi_uhub_find_rh(dev, &ah); if (ACPI_SUCCESS(status) && ah != NULL @@ -308,7 +314,7 @@ acpi_uhub_probe(device_t dev) { ACPI_HANDLE ah = acpi_get_handle(dev); - if (ah && (uhub_probe(dev) <= 0)) { + if (!acpi_disabled("usb") && ah && (uhub_probe(dev) <= 0)) { /*success prior than non - acpi hub*/ return (BUS_PROBE_DEFAULT + 1); } @@ -335,7 +341,6 @@ acpi_uhub_root_attach(device_t dev) sc->nports = uh->nports; sc->porthandle = malloc(sizeof(ACPI_HANDLE) * uh->nports, M_USBDEV, M_WAITOK | M_ZERO); - acpi_uhub_find_rh(dev, &devhandle); acpi_usb_hub_port_probe(dev, devhandle); return 0; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r349161 - in head/sys: conf dev/usb modules/usb/usb
ub *hub, device_t child, struct hub_result *res) { @@ -1673,7 +1635,7 @@ uhub_find_iface_index(struct usb_hub *hub, device_t ch res->portno = 0; } -static int +int uhub_child_location_string(device_t parent, device_t child, char *buf, size_t buflen) { Added: head/sys/dev/usb/usb_hub_acpi.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/usb/usb_hub_acpi.c Mon Jun 17 23:03:30 2019 (r349161) @@ -0,0 +1,451 @@ +/* $FreeBSD$ */ +/*- + * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * + * Copyright (c) 1998 The NetBSD Foundation, Inc. All rights reserved. + * Copyright (c) 1998 Lennart Augustsson. All rights reserved. + * Copyright (c) 2008-2010 Hans Petter Selasky. All rights reserved. + * Copyright (c) 2019 Takanori Watanabe. + * + * 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. + */ + +/* + * USB spec: http://www.usb.org/developers/docs/usbspec.zip + */ + +#ifdef USB_GLOBAL_INCLUDE_FILE +#include USB_GLOBAL_INCLUDE_FILE +#else +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#defineUSB_DEBUG_VAR uhub_debug + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#endif /* USB_GLOBAL_INCLUDE_FILE */ +#include +#include +#include +#include + +static UINT32 acpi_uhub_find_rh_cb(ACPI_HANDLE ah, UINT32 nl, void *ctx, void **status); +static ACPI_STATUS acpi_uhub_find_rh(device_t dev, ACPI_HANDLE * ah); +static ACPI_STATUS +acpi_usb_hub_port_probe_cb(ACPI_HANDLE ah, UINT32 lv, void *ctx, void **rv); +static ACPI_STATUS acpi_usb_hub_port_probe(device_t dev, ACPI_HANDLE ah); +static int acpi_uhub_root_probe(device_t dev); +static int acpi_uhub_probe(device_t dev); +static int acpi_uhub_root_attach(device_t dev); +static int acpi_uhub_attach(device_t dev); +static int acpi_uhub_detach(device_t dev); +static int +acpi_uhub_read_ivar(device_t dev, device_t child, int idx, +uintptr_t *res); +static int +acpi_uhub_child_location_string(device_t parent, device_t child, +char *buf, size_t buflen); +static int acpi_uhub_parse_upc(device_t dev, unsigned int port, ACPI_HANDLE ah); + +struct acpi_uhub_softc { + struct uhub_softc usc; + uint8_t nports; + ACPI_HANDLE *porthandle; +}; + +UINT32 +acpi_uhub_find_rh_cb(ACPI_HANDLE ah, UINT32 nl, void *ctx, void **status){ + ACPI_DEVICE_INFO *devinfo; + UINT32 ret = AE_OK; + + *status = NULL; + devinfo = NULL; + + ret = AcpiGetObjectInfo(ah, &devinfo); + + if (ACPI_FAILURE(ret)) { + return ret; + } + if ((devinfo->Valid & ACPI_VALID_ADR) && + (devinfo->Address == 0)) { + ret = AE_CTRL_TERMINATE; + *status = ah; + } + AcpiOsFree(devinfo); + + return ret; +} + +static int +acpi_uhub_parse_upc(device_t dev, unsigned int port, ACPI_HANDLE ah) +{ + ACPI_BUFFER buf; + + buf.Pointer = NULL; + buf.Length = ACPI_ALLOCATE_BUFFER; + if (AcpiEvaluateObject(ah, "_UPC", NULL, &buf) == AE_OK) { + UINT64 porttypenum, conn; + const char *connectable; + const char *typelist[] = {"TypeA", "MiniAB", "Express", + "USB3-A", "USB3-B", "USB-MicroB", + &
svn commit: r343438 - in head: sys/dev/tpm usr.sbin/acpi/acpidump
Author: takawata Date: Fri Jan 25 16:16:10 2019 New Revision: 343438 URL: https://svnweb.freebsd.org/changeset/base/343438 Log: Use ACPI TPM2 table to probe tpmtis and tpmcrb device. Differential Revision: https://reviews.freebsd.org/D18937 Modified: head/sys/dev/tpm/tpm20.h head/sys/dev/tpm/tpm_crb.c head/sys/dev/tpm/tpm_tis.c head/usr.sbin/acpi/acpidump/acpi.c Modified: head/sys/dev/tpm/tpm20.h == --- head/sys/dev/tpm/tpm20.hFri Jan 25 15:48:00 2019(r343437) +++ head/sys/dev/tpm/tpm20.hFri Jan 25 16:16:10 2019(r343438) @@ -93,6 +93,12 @@ __FBSDID("$FreeBSD$"); #defineTPM_CDEV_NAME "tpm0" #defineTPM_CDEV_PERM_FLAG 0600 + +#define TPM2_START_METHOD_ACPI 2 +#define TPM2_START_METHOD_TIS 6 +#define TPM2_START_METHOD_CRB 7 +#define TPM2_START_METHOD_CRB_ACPI 8 + struct tpm_sc { device_tdev; Modified: head/sys/dev/tpm/tpm_crb.c == --- head/sys/dev/tpm/tpm_crb.c Fri Jan 25 15:48:00 2019(r343437) +++ head/sys/dev/tpm/tpm_crb.c Fri Jan 25 16:16:10 2019(r343438) @@ -104,27 +104,20 @@ char *tpmcrb_ids[] = {"MSFT0101", NULL}; static int tpmcrb_acpi_probe(device_t dev) { - struct resource *res; - int err, rid = 0; - uint32_t caps; - + int err; + ACPI_TABLE_TPM23 *tbl; + ACPI_STATUS status; err = ACPI_ID_PROBE(device_get_parent(dev), dev, tpmcrb_ids, NULL); if (err > 0) return (err); + /*Find TPM2 Header*/ + status = AcpiGetTable(ACPI_SIG_TPM2, 1, (ACPI_TABLE_HEADER **) &tbl); + if(ACPI_FAILURE(status) || + tbl->StartMethod != TPM2_START_METHOD_CRB) + err = ENXIO; - /* Check if device is in CRB mode */ - res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); - if (res == NULL) - return (ENXIO); - - caps = bus_read_4(res, TPM_CRB_INTF_ID); - bus_release_resource(dev, SYS_RES_MEMORY, rid, res); - - if ((caps & TPM_CRB_INTF_ID_TYPE) != TPM_CRB_INTF_ID_TYPE_CRB) - return (ENXIO); - device_set_desc(dev, "Trusted Platform Module 2.0, CRB mode"); - return (BUS_PROBE_DEFAULT); + return (err); } static ACPI_STATUS Modified: head/sys/dev/tpm/tpm_tis.c == --- head/sys/dev/tpm/tpm_tis.c Fri Jan 25 15:48:00 2019(r343437) +++ head/sys/dev/tpm/tpm_tis.c Fri Jan 25 16:16:10 2019(r343438) @@ -100,26 +100,21 @@ char *tpmtis_ids[] = {"MSFT0101", NULL}; static int tpmtis_acpi_probe(device_t dev) { - struct resource *res; - int err, rid = 0; - uint32_t caps; + int err; + ACPI_TABLE_TPM23 *tbl; + ACPI_STATUS status; err = ACPI_ID_PROBE(device_get_parent(dev), dev, tpmtis_ids, NULL); if (err > 0) return (err); + /*Find TPM2 Header*/ + status = AcpiGetTable(ACPI_SIG_TPM2, 1, (ACPI_TABLE_HEADER **) &tbl); + if(ACPI_FAILURE(status) || + tbl->StartMethod != TPM2_START_METHOD_TIS) + err = ENXIO; - /* Check if device is in TPM 2.0 TIS mode */ - res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); - if (res == NULL) - return (ENXIO); - - caps = bus_read_4(res, TPM_INTF_CAPS); - bus_release_resource(dev, SYS_RES_MEMORY, rid, res); - if ((caps & TPM_INTF_CAPS_VERSION) != TPM_INTF_CAPS_TPM20) - return (ENXIO); - device_set_desc(dev, "Trusted Platform Module 2.0, FIFO mode"); - return (BUS_PROBE_DEFAULT); + return (err); } static int Modified: head/usr.sbin/acpi/acpidump/acpi.c == --- head/usr.sbin/acpi/acpidump/acpi.c Fri Jan 25 15:48:00 2019 (r343437) +++ head/usr.sbin/acpi/acpidump/acpi.c Fri Jan 25 16:16:10 2019 (r343438) @@ -970,7 +970,18 @@ acpi_handle_tcpa(ACPI_TABLE_HEADER *sdp) printf(END_COMMENT); } - +static void acpi_handle_tpm2(ACPI_TABLE_HEADER *sdp) +{ + ACPI_TABLE_TPM2 *tpm2; + + printf (BEGIN_COMMENT); + acpi_print_sdt(sdp); + tpm2 = (ACPI_TABLE_TPM2 *) sdp; + printf ("\t\tControlArea=%lx\n", tpm2->ControlAddress); + printf ("\t\tStartMethod=%x\n", tpm2->StartMethod); + printf (END_COMMENT); +} + static const char * devscope_type2str(int type) { @@ -1769,6 +1780,8 @@ acpi_handle_rsdt(ACPI_TABLE_HEADER *rsdp) acpi_handle_wddt(sdp); else if (!memcmp(sdp->Signature, ACPI_SIG_LPIT, 4)) acpi_handle_lpit(sdp); + else if (!memcmp(sdp->Signature, ACPI_SIG_TPM2, 4)) + acpi_handle_tpm2(sdp);
svn commit: r339754 - in head/sys/dev: acpi_support acpica amdgpio asmc fdc gpio hyperv/vmbus ichiic intel ipmi sdhci tpm
Author: takawata Date: Fri Oct 26 00:05:46 2018 New Revision: 339754 URL: https://svnweb.freebsd.org/changeset/base/339754 Log: Distinguish _CID match and _HID match and make lower priority probe when _CID match. Reviewed by: jhb, imp Differential Revision:https://reviews.freebsd.org/D16468 Modified: head/sys/dev/acpi_support/acpi_asus.c head/sys/dev/acpi_support/acpi_fujitsu.c head/sys/dev/acpi_support/acpi_ibm.c head/sys/dev/acpi_support/acpi_panasonic.c head/sys/dev/acpi_support/acpi_rapidstart.c head/sys/dev/acpi_support/acpi_sony.c head/sys/dev/acpi_support/acpi_toshiba.c head/sys/dev/acpi_support/acpi_wmi.c head/sys/dev/acpi_support/atk0110.c head/sys/dev/acpica/acpi.c head/sys/dev/acpica/acpi_acad.c head/sys/dev/acpica/acpi_button.c head/sys/dev/acpica/acpi_cmbat.c head/sys/dev/acpica/acpi_container.c head/sys/dev/acpica/acpi_cpu.c head/sys/dev/acpica/acpi_ec.c head/sys/dev/acpica/acpi_hpet.c head/sys/dev/acpica/acpi_if.m head/sys/dev/acpica/acpi_isab.c head/sys/dev/acpica/acpi_lid.c head/sys/dev/acpica/acpi_pci_link.c head/sys/dev/acpica/acpi_resource.c head/sys/dev/acpica/acpi_smbat.c head/sys/dev/acpica/acpivar.h head/sys/dev/amdgpio/amdgpio.c head/sys/dev/asmc/asmc.c head/sys/dev/fdc/fdc_acpi.c head/sys/dev/gpio/bytgpio.c head/sys/dev/gpio/chvgpio.c head/sys/dev/hyperv/vmbus/vmbus_res.c head/sys/dev/ichiic/ig4_acpi.c head/sys/dev/intel/spi.c head/sys/dev/ipmi/ipmi_acpi.c head/sys/dev/sdhci/sdhci_acpi.c head/sys/dev/tpm/tpm_acpi.c Modified: head/sys/dev/acpi_support/acpi_asus.c == --- head/sys/dev/acpi_support/acpi_asus.c Fri Oct 26 00:00:13 2018 (r339753) +++ head/sys/dev/acpi_support/acpi_asus.c Fri Oct 26 00:05:46 2018 (r339754) @@ -549,15 +549,16 @@ acpi_asus_probe(device_t dev) ACPI_OBJECT Arg, *Obj; ACPI_OBJECT_LISTArgs; static char *asus_ids[] = { "ATK0100", "ASUS010", NULL }; + int rv; char *rstr; ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); if (acpi_disabled("asus")) return (ENXIO); - rstr = ACPI_ID_PROBE(device_get_parent(dev), dev, asus_ids); - if (rstr == NULL) { - return (ENXIO); + rv = ACPI_ID_PROBE(device_get_parent(dev), dev, asus_ids, &rstr); + if (rv > 0) { + return (rv); } sc = device_get_softc(dev); @@ -595,7 +596,7 @@ acpi_asus_probe(device_t dev) sc->model = &acpi_samsung_models[0]; device_set_desc(dev, "Samsung P30 Laptop Extras"); AcpiOsFree(Buf.Pointer); - return (0); + return (rv); } /* EeePC */ @@ -603,7 +604,7 @@ acpi_asus_probe(device_t dev) sc->model = &acpi_eeepc_models[0]; device_set_desc(dev, "ASUS EeePC"); AcpiOsFree(Buf.Pointer); - return (0); + return (rv); } } @@ -627,7 +628,7 @@ good: sbuf_delete(sb); AcpiOsFree(Buf.Pointer); - return (0); + return (rv); } /* Modified: head/sys/dev/acpi_support/acpi_fujitsu.c == --- head/sys/dev/acpi_support/acpi_fujitsu.cFri Oct 26 00:00:13 2018 (r339753) +++ head/sys/dev/acpi_support/acpi_fujitsu.cFri Oct 26 00:05:46 2018 (r339754) @@ -228,16 +228,15 @@ acpi_fujitsu_probe(device_t dev) { char *name; char buffer[64]; + int rv; - name = ACPI_ID_PROBE(device_get_parent(dev), dev, fujitsu_ids); - if (acpi_disabled("fujitsu") || name == NULL || - device_get_unit(dev) > 1) + rv = ACPI_ID_PROBE(device_get_parent(dev), dev, fujitsu_ids, &name); + if (acpi_disabled("fujitsu") || rv > 0 || device_get_unit(dev) > 1) return (ENXIO); - sprintf(buffer, "Fujitsu Function Hotkeys %s", name); device_set_desc_copy(dev, buffer); - return (0); + return (rv); } static int Modified: head/sys/dev/acpi_support/acpi_ibm.c == --- head/sys/dev/acpi_support/acpi_ibm.cFri Oct 26 00:00:13 2018 (r339753) +++ head/sys/dev/acpi_support/acpi_ibm.cFri Oct 26 00:05:46 2018 (r339754) @@ -411,14 +411,17 @@ acpi_ibm_mic_led_set (struct acpi_ibm_softc *sc, int a static int acpi_ibm_probe(device_t dev) { + int rv; + if (acpi_disabled("ibm") || - ACPI_ID_PROBE(device_get_parent(dev), dev, ibm_ids) == NULL || device_get_unit(
svn commit: r317506 - in head: lib/libbluetooth sys/netgraph/bluetooth/hci sys/netgraph/bluetooth/include usr.sbin/bluetooth/hccontrol
Author: takawata Date: Thu Apr 27 15:03:24 2017 New Revision: 317506 URL: https://svnweb.freebsd.org/changeset/base/317506 Log: Make cached Bluetooth LE host advertise information visible from userland. Differential Revision:https://reviews.freebsd.org/D10362 Modified: head/lib/libbluetooth/bluetooth.h head/sys/netgraph/bluetooth/hci/ng_hci_evnt.c head/sys/netgraph/bluetooth/hci/ng_hci_main.c head/sys/netgraph/bluetooth/hci/ng_hci_var.h head/sys/netgraph/bluetooth/include/ng_bluetooth.h head/sys/netgraph/bluetooth/include/ng_btsocket.h head/sys/netgraph/bluetooth/include/ng_hci.h head/usr.sbin/bluetooth/hccontrol/node.c Modified: head/lib/libbluetooth/bluetooth.h == --- head/lib/libbluetooth/bluetooth.h Thu Apr 27 14:39:52 2017 (r317505) +++ head/lib/libbluetooth/bluetooth.h Thu Apr 27 15:03:24 2017 (r317506) @@ -46,6 +46,7 @@ #include #include +#include #include #include #include Modified: head/sys/netgraph/bluetooth/hci/ng_hci_evnt.c == --- head/sys/netgraph/bluetooth/hci/ng_hci_evnt.c Thu Apr 27 14:39:52 2017(r317505) +++ head/sys/netgraph/bluetooth/hci/ng_hci_evnt.c Thu Apr 27 15:03:24 2017(r317506) @@ -417,7 +417,6 @@ le_advertizing_report(ng_hci_unit_p unit } else getmicrotime(&n->updated); -#if 0 { /* * TODO: Make these information @@ -425,21 +424,36 @@ le_advertizing_report(ng_hci_unit_p unit */ u_int8_t length_data; - char *rssi; - - NG_HCI_M_PULLUP(event, sizeof(u_int8_t)); + event = m_pullup(event, sizeof(u_int8_t)); + if(event == NULL){ + NG_HCI_WARN("%s: Event datasize Pullup Failed\n", __func__); + goto out; + } length_data = *mtod(event, u_int8_t *); m_adj(event, sizeof(u_int8_t)); + n->extinq_size = (length_data < NG_HCI_EXTINQ_MAX)? + length_data : NG_HCI_EXTINQ_MAX; + /*Advertizement data*/ - NG_HCI_M_PULLUP(event, length_data); - m_adj(event, length_data); - NG_HCI_M_PULLUP(event, sizeof(char )); + event = m_pullup(event, n->extinq_size); + if(event == NULL){ + NG_HCI_WARN("%s: Event data pullup Failed\n", __func__); + goto out; + } + m_copydata(event, 0, n->extinq_size, n->extinq_data); + m_adj(event, n->extinq_size); + event = m_pullup(event, sizeof(char )); /*Get RSSI*/ - rssi = mtod(event, char *); + if(event == NULL){ + NG_HCI_WARN("%s: Event rssi pull up Failed\n", __func__); + + goto out; + } + n->page_scan_mode = *mtod(event, char *); m_adj(event, sizeof(u_int8_t)); } -#endif } + out: NG_FREE_M(event); return (error); Modified: head/sys/netgraph/bluetooth/hci/ng_hci_main.c == --- head/sys/netgraph/bluetooth/hci/ng_hci_main.c Thu Apr 27 14:39:52 2017(r317505) +++ head/sys/netgraph/bluetooth/hci/ng_hci_main.c Thu Apr 27 15:03:24 2017(r317506) @@ -93,7 +93,22 @@ NETGRAPH_INIT(hci, &typestruct); MODULE_VERSION(ng_hci, NG_BLUETOOTH_VERSION); MODULE_DEPEND(ng_hci, ng_bluetooth, NG_BLUETOOTH_VERSION, NG_BLUETOOTH_VERSION, NG_BLUETOOTH_VERSION); +static int ng_hci_linktype_to_addrtype(int linktype); +static int ng_hci_linktype_to_addrtype(int linktype) +{ + switch(linktype){ + case NG_HCI_LINK_LE_PUBLIC: + return BDADDR_LE_PUBLIC; + case NG_HCI_LINK_LE_RANDOM: + return BDADDR_LE_RANDOM; + case NG_HCI_LINK_ACL: + /*FALLTHROUGH*/ + default: + return BDADDR_BREDR; + } + return BDADDR_BREDR; +} /* * ** Netgraph methods implementation @@ -481,11 +496,15 @@ ng_hci_default_rcvmsg(node_p
svn commit: r301558 - in head/sys/netgraph/bluetooth: l2cap socket
Author: takawata Date: Tue Jun 7 16:57:13 2016 New Revision: 301558 URL: https://svnweb.freebsd.org/changeset/base/301558 Log: Disconnect LE socket when the HCI connection associated is disconnected. Modified: head/sys/netgraph/bluetooth/l2cap/ng_l2cap_misc.c head/sys/netgraph/bluetooth/l2cap/ng_l2cap_ulpi.c head/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c Modified: head/sys/netgraph/bluetooth/l2cap/ng_l2cap_misc.c == --- head/sys/netgraph/bluetooth/l2cap/ng_l2cap_misc.c Tue Jun 7 16:56:15 2016(r301557) +++ head/sys/netgraph/bluetooth/l2cap/ng_l2cap_misc.c Tue Jun 7 16:57:13 2016(r301558) @@ -346,7 +346,8 @@ ng_l2cap_new_chan(ng_l2cap_p l2cap, ng_l ch->scid = ng_l2cap_get_cid(l2cap, (con->linktype!= NG_HCI_LINK_ACL)); } - + + ch->idtype = idtype; if (ch->scid != NG_L2CAP_NULL_CID) { /* Initialize channel */ ch->psm = psm; Modified: head/sys/netgraph/bluetooth/l2cap/ng_l2cap_ulpi.c == --- head/sys/netgraph/bluetooth/l2cap/ng_l2cap_ulpi.c Tue Jun 7 16:56:15 2016(r301557) +++ head/sys/netgraph/bluetooth/l2cap/ng_l2cap_ulpi.c Tue Jun 7 16:57:13 2016(r301558) @@ -1389,7 +1389,13 @@ ng_l2cap_l2ca_discon_ind(ng_l2cap_chan_p error = ENOMEM; else { ip = (ng_l2cap_l2ca_discon_ind_ip *)(msg->data); - ip->lcid = ch->scid; + ip->idtype = ch->idtype; + if(ch->idtype == NG_L2CAP_L2CA_IDTYPE_ATT|| + ch->idtype == NG_L2CAP_L2CA_IDTYPE_SMP) + ip->lcid = ch->con->con_handle; + else + ip->lcid = ch->scid; + NG_SEND_MSG_HOOK(error, l2cap->node, msg, l2cap->l2c, 0); } Modified: head/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c == --- head/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c Tue Jun 7 16:56:15 2016(r301557) +++ head/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c Tue Jun 7 16:57:13 2016(r301558) @@ -1115,7 +1115,7 @@ ng_btsocket_l2cap_process_l2ca_discon_in /* Look for the socket with given channel ID */ pcb = ng_btsocket_l2cap_pcb_by_cid(&rt->src, ip->lcid, - NG_L2CAP_L2CA_IDTYPE_BREDR); + ip->idtype); if (pcb == NULL) { mtx_unlock(&ng_btsocket_l2cap_sockets_mtx); return (0); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r290491 - in head/sys/netgraph/bluetooth: hci socket
Author: takawata Date: Sat Nov 7 12:15:02 2015 New Revision: 290491 URL: https://svnweb.freebsd.org/changeset/base/290491 Log: Fix encryption error handling. Close l2cap connection on encryption error. Modified: head/sys/netgraph/bluetooth/hci/ng_hci_evnt.c head/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c Modified: head/sys/netgraph/bluetooth/hci/ng_hci_evnt.c == --- head/sys/netgraph/bluetooth/hci/ng_hci_evnt.c Sat Nov 7 12:11:17 2015(r290490) +++ head/sys/netgraph/bluetooth/hci/ng_hci_evnt.c Sat Nov 7 12:15:02 2015(r290491) @@ -913,17 +913,17 @@ encryption_change(ng_hci_unit_p unit, st ng_hci_encryption_change_ep *ep = NULL; ng_hci_unit_con_pcon = NULL; int error = 0; + u_int16_t h; NG_HCI_M_PULLUP(event, sizeof(*ep)); if (event == NULL) return (ENOBUFS); ep = mtod(event, ng_hci_encryption_change_ep *); + h = NG_HCI_CON_HANDLE(le16toh(ep->con_handle)); + con = ng_hci_con_by_handle(unit, h); if (ep->status == 0) { - u_int16_t h = NG_HCI_CON_HANDLE(le16toh(ep->con_handle)); - - con = ng_hci_con_by_handle(unit, h); if (con == NULL) { NG_HCI_ALERT( "%s: %s - invalid connection handle=%d\n", @@ -940,12 +940,14 @@ encryption_change(ng_hci_unit_p unit, st con->encryption_mode = NG_HCI_ENCRYPTION_MODE_P2P; else con->encryption_mode = NG_HCI_ENCRYPTION_MODE_NONE; - ng_hci_lp_enc_change(con, ep->encryption_enable); } else NG_HCI_ERR( "%s: %s - failed to change encryption mode, status=%d\n", __func__, NG_NODE_NAME(unit->node), ep->status); + /*Anyway, propagete encryption status to upper layer*/ + ng_hci_lp_enc_change(con, con->encryption_mode); + NG_FREE_M(event); return (error); Modified: head/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c == --- head/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c Sat Nov 7 12:11:17 2015(r290490) +++ head/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c Sat Nov 7 12:15:02 2015(r290491) @@ -467,6 +467,7 @@ ng_btsocket_l2cap_process_l2ca_con_req_r (pcb->idtype == NG_L2CAP_L2CA_IDTYPE_SMP)){ pcb->encryption = op->encryption; pcb->cid = op->lcid; if(pcb->need_encrypt && !(pcb->encryption)){ + ng_btsocket_l2cap_timeout(pcb); pcb->state = NG_BTSOCKET_L2CAP_W4_ENC_CHANGE; }else{ pcb->state = NG_BTSOCKET_L2CAP_OPEN; @@ -713,6 +714,7 @@ static int ng_btsocket_l2cap_process_l2c pcb->encryption = op->result; if(pcb->need_encrypt){ + ng_btsocket_l2cap_untimeout(pcb); if(pcb->state != NG_BTSOCKET_L2CAP_W4_ENC_CHANGE){ NG_BTSOCKET_L2CAP_WARN("%s: Invalid pcb status %d", __func__, pcb->state); @@ -721,6 +723,7 @@ static int ng_btsocket_l2cap_process_l2c soisconnected(pcb->so); }else{ pcb->so->so_error = EPERM; + ng_btsocket_l2cap_send_l2ca_discon_req(0, pcb); pcb->state = NG_BTSOCKET_L2CAP_CLOSED; soisdisconnected(pcb->so); } @@ -2844,6 +2847,7 @@ ng_btsocket_l2cap_process_timeout(void * switch (pcb->state) { case NG_BTSOCKET_L2CAP_CONNECTING: case NG_BTSOCKET_L2CAP_CONFIGURING: + case NG_BTSOCKET_L2CAP_W4_ENC_CHANGE: /* Send disconnect request with "zero" token */ if (pcb->cid != 0) ng_btsocket_l2cap_send_l2ca_discon_req(0, pcb); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r290038 - in head/sys/netgraph/bluetooth: hci include l2cap socket
Author: takawata Date: Tue Oct 27 03:42:26 2015 New Revision: 290038 URL: https://svnweb.freebsd.org/changeset/base/290038 Log: Bluetooth LE Security Management channel support. Add a socket option to block until underlying HCI connection encrypted. Differential Revision:https://reviews.freebsd.org/D3981 Modified: head/sys/netgraph/bluetooth/hci/ng_hci_evnt.c head/sys/netgraph/bluetooth/hci/ng_hci_ulpi.c head/sys/netgraph/bluetooth/hci/ng_hci_ulpi.h head/sys/netgraph/bluetooth/include/ng_btsocket.h head/sys/netgraph/bluetooth/include/ng_btsocket_l2cap.h head/sys/netgraph/bluetooth/include/ng_hci.h head/sys/netgraph/bluetooth/include/ng_l2cap.h head/sys/netgraph/bluetooth/l2cap/ng_l2cap_evnt.c head/sys/netgraph/bluetooth/l2cap/ng_l2cap_llpi.c head/sys/netgraph/bluetooth/l2cap/ng_l2cap_llpi.h head/sys/netgraph/bluetooth/l2cap/ng_l2cap_main.c head/sys/netgraph/bluetooth/l2cap/ng_l2cap_misc.c head/sys/netgraph/bluetooth/l2cap/ng_l2cap_ulpi.c head/sys/netgraph/bluetooth/l2cap/ng_l2cap_ulpi.h head/sys/netgraph/bluetooth/l2cap/ng_l2cap_var.h head/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c Modified: head/sys/netgraph/bluetooth/hci/ng_hci_evnt.c == --- head/sys/netgraph/bluetooth/hci/ng_hci_evnt.c Tue Oct 27 03:02:48 2015(r290037) +++ head/sys/netgraph/bluetooth/hci/ng_hci_evnt.c Tue Oct 27 03:42:26 2015(r290038) @@ -929,7 +929,7 @@ encryption_change(ng_hci_unit_p unit, st "%s: %s - invalid connection handle=%d\n", __func__, NG_NODE_NAME(unit->node), h); error = ENOENT; - } else if (con->link_type != NG_HCI_LINK_ACL) { + } else if (con->link_type == NG_HCI_LINK_SCO) { NG_HCI_ALERT( "%s: %s - invalid link type=%d\n", __func__, NG_NODE_NAME(unit->node), @@ -940,6 +940,7 @@ encryption_change(ng_hci_unit_p unit, st con->encryption_mode = NG_HCI_ENCRYPTION_MODE_P2P; else con->encryption_mode = NG_HCI_ENCRYPTION_MODE_NONE; + ng_hci_lp_enc_change(con, ep->encryption_enable); } else NG_HCI_ERR( "%s: %s - failed to change encryption mode, status=%d\n", Modified: head/sys/netgraph/bluetooth/hci/ng_hci_ulpi.c == --- head/sys/netgraph/bluetooth/hci/ng_hci_ulpi.c Tue Oct 27 03:02:48 2015(r290037) +++ head/sys/netgraph/bluetooth/hci/ng_hci_ulpi.c Tue Oct 27 03:42:26 2015(r290038) @@ -814,6 +814,37 @@ ng_hci_lp_con_cfm(ng_hci_unit_con_p con, return (0); } /* ng_hci_lp_con_cfm */ +int +ng_hci_lp_enc_change(ng_hci_unit_con_p con, int status) +{ + ng_hci_unit_punit = con->unit; + struct ng_mesg *msg = NULL; + ng_hci_lp_enc_change_ep *ep = NULL; + int error; + + + if (con->link_type != NG_HCI_LINK_SCO) { + if (unit->acl != NULL && NG_HOOK_IS_VALID(unit->acl)) { + NG_MKMESSAGE(msg, NGM_HCI_COOKIE, NGM_HCI_LP_ENC_CHG, + sizeof(*ep), M_NOWAIT); + if (msg != NULL) { + ep = (ng_hci_lp_enc_change_ep *) msg->data; + ep->status = status; + ep->link_type = con->link_type; + ep->con_handle = con->con_handle; + + NG_SEND_MSG_HOOK(error, unit->node, msg, + unit->acl, 0); + } + } else + NG_HCI_INFO( +"%s: %s - ACL hook not valid, hook=%p\n", + __func__, NG_NODE_NAME(unit->node), unit->acl); + + } + return (0); +} /* ng_hci_lp_con_cfm */ + /* * Send LP_ConnectInd event to the upper layer protocol */ Modified: head/sys/netgraph/bluetooth/hci/ng_hci_ulpi.h == --- head/sys/netgraph/bluetooth/hci/ng_hci_ulpi.h Tue Oct 27 03:02:48 2015(r290037) +++ head/sys/netgraph/bluetooth/hci/ng_hci_ulpi.h Tue Oct 27 03:42:26 2015(r290038) @@ -47,6 +47,7 @@ int ng_hci_lp_discon_ind int ng_hci_lp_qos_req (ng_hci_unit_p, item_p, hook_p); int ng_hci_lp_qos_cfm (ng_hci_unit_con_p, int); int ng_hci_lp_qos_ind (ng_hci_unit_con_p); +int ng_hci_lp_enc_change(ng_hci_unit_con_p, int); void ng_hci_process_con_timeout (node_p, hook_p, void *, int); Modified: head/sys/netgraph/bluetooth/include/ng_btsocket.h == --- head/sys/netg
svn commit: r287597 - head/usr.sbin/bluetooth/hccontrol
Author: takawata Date: Wed Sep 9 13:24:39 2015 New Revision: 287597 URL: https://svnweb.freebsd.org/changeset/base/287597 Log: fix compare argument for address type. Submitted by: issei10193 (via Twitter) Modified: head/usr.sbin/bluetooth/hccontrol/le.c Modified: head/usr.sbin/bluetooth/hccontrol/le.c == --- head/usr.sbin/bluetooth/hccontrol/le.c Wed Sep 9 11:51:14 2015 (r287596) +++ head/usr.sbin/bluetooth/hccontrol/le.c Wed Sep 9 13:24:39 2015 (r287597) @@ -88,7 +88,7 @@ le_set_scan_param(int s, int argc, char if (strcmp(argv[3], "public") == 0) adrtype = 0; - else if (strcmp(argv[0], "random") == 0) + else if (strcmp(argv[3], "random") == 0) adrtype = 1; else return USAGE; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r285244 - in head/sys/netgraph/bluetooth: l2cap socket
Author: takawata Date: Tue Jul 7 15:56:51 2015 New Revision: 285244 URL: https://svnweb.freebsd.org/changeset/base/285244 Log: Fix rfcomm_sppd regression I could reproduced. To reproduce it, Two machine running FreeBSD and run rfcomm_sppd -c 3 -S rfcomm_sppd -a ${PEER} -c 3 on each side. Modified: head/sys/netgraph/bluetooth/l2cap/ng_l2cap_ulpi.c head/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c Modified: head/sys/netgraph/bluetooth/l2cap/ng_l2cap_ulpi.c == --- head/sys/netgraph/bluetooth/l2cap/ng_l2cap_ulpi.c Tue Jul 7 15:22:29 2015(r285243) +++ head/sys/netgraph/bluetooth/l2cap/ng_l2cap_ulpi.c Tue Jul 7 15:56:51 2015(r285244) @@ -398,7 +398,7 @@ ng_l2cap_l2ca_con_ind(ng_l2cap_chan_p ch ip->lcid = ch->scid; ip->psm = ch->psm; ip->ident = ch->ident; - + ip->linktype = ch->con->linktype; NG_SEND_MSG_HOOK(error, l2cap->node, msg, l2cap->l2c, 0); } Modified: head/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c == --- head/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c Tue Jul 7 15:22:29 2015(r285243) +++ head/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c Tue Jul 7 15:56:51 2015(r285244) @@ -1339,6 +1339,8 @@ ng_btsocket_rfcomm_session_create(ng_bts l2sa.l2cap_family = AF_BLUETOOTH; l2sa.l2cap_psm = (dst == NULL)? htole16(NG_L2CAP_PSM_RFCOMM) : 0; bcopy(src, &l2sa.l2cap_bdaddr, sizeof(l2sa.l2cap_bdaddr)); + l2sa.l2cap_cid = 0; + l2sa.l2cap_bdaddr_type = BDADDR_BREDR; error = sobind(s->l2so, (struct sockaddr *) &l2sa, td); if (error != 0) @@ -1360,6 +1362,8 @@ ng_btsocket_rfcomm_session_create(ng_bts l2sa.l2cap_family = AF_BLUETOOTH; l2sa.l2cap_psm = htole16(NG_L2CAP_PSM_RFCOMM); bcopy(dst, &l2sa.l2cap_bdaddr, sizeof(l2sa.l2cap_bdaddr)); + l2sa.l2cap_cid = 0; + l2sa.l2cap_bdaddr_type = BDADDR_BREDR; error = soconnect(s->l2so, (struct sockaddr *) &l2sa, td); if (error != 0) ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r281920 - head/sys/dev/ichsmb
Author: takawata Date: Fri Apr 24 07:24:31 2015 New Revision: 281920 URL: https://svnweb.freebsd.org/changeset/base/281920 Log: Add Lynx-Point LP smbus controller ID. Modified: head/sys/dev/ichsmb/ichsmb_pci.c Modified: head/sys/dev/ichsmb/ichsmb_pci.c == --- head/sys/dev/ichsmb/ichsmb_pci.cFri Apr 24 05:00:57 2015 (r281919) +++ head/sys/dev/ichsmb/ichsmb_pci.cFri Apr 24 07:24:31 2015 (r281920) @@ -88,6 +88,7 @@ __FBSDID("$FreeBSD$"); #define ID_AVOTON 0x1f3c8086 #define ID_COLETOCRK 0x23B08086 #define ID_LPT 0x8c228086 +#define ID_LPTLP 0x9c228086 #define ID_WCPT0x8ca28086 #define ID_WCPTLP 0x9ca28086 @@ -199,6 +200,9 @@ ichsmb_pci_probe(device_t dev) case ID_LPT: device_set_desc(dev, "Intel Lynx Point SMBus controller"); break; + case ID_LPTLP: + device_set_desc(dev, "Intel Lynx Point-LP SMBus controller"); + break; case ID_WCPT: device_set_desc(dev, "Intel Wildcat Point SMBus controller"); break; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r281697 - head/usr.sbin/bluetooth/hccontrol
Author: takawata Date: Sat Apr 18 17:41:09 2015 New Revision: 281697 URL: https://svnweb.freebsd.org/changeset/base/281697 Log: To ensure j formatting string valid, cast uint64_t values to uintmax_t. Modified: head/usr.sbin/bluetooth/hccontrol/le.c Modified: head/usr.sbin/bluetooth/hccontrol/le.c == --- head/usr.sbin/bluetooth/hccontrol/le.c Sat Apr 18 17:21:12 2015 (r281696) +++ head/usr.sbin/bluetooth/hccontrol/le.c Sat Apr 18 17:41:09 2015 (r281697) @@ -43,6 +43,7 @@ #include #include #include +#include #define L2CAP_SOCKET_CHECKED #include #include "hccontrol.h" @@ -233,7 +234,7 @@ le_read_local_supported_features(int s, (void *)&rp, &n); printf("LOCAL SUPPORTED: %d %d %jx\n", e, rp.status, - rp.le_features); + (uintmax_t) rp.le_features); return 0; } @@ -250,7 +251,7 @@ le_read_supported_status(int s, int argc NG_HCI_OCF_LE_READ_SUPPORTED_STATUS), (void *)&rp, &n); - printf("LE_STATUS: %d %d %jx\n", e, rp.status, rp.le_status); + printf("LE_STATUS: %d %d %jx\n", e, rp.status, (uintmax_t)rp.le_status); return 0; } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r281690 - head/usr.sbin/bluetooth/hccontrol
Author: takawata Date: Sat Apr 18 16:04:32 2015 New Revision: 281690 URL: https://svnweb.freebsd.org/changeset/base/281690 Log: Change printf formatting to unbroke i386 arch. Submitted by:da...@catwhisker.org Modified: head/usr.sbin/bluetooth/hccontrol/le.c Modified: head/usr.sbin/bluetooth/hccontrol/le.c == --- head/usr.sbin/bluetooth/hccontrol/le.c Sat Apr 18 09:49:09 2015 (r281689) +++ head/usr.sbin/bluetooth/hccontrol/le.c Sat Apr 18 16:04:32 2015 (r281690) @@ -232,7 +232,7 @@ le_read_local_supported_features(int s, NG_HCI_OCF_LE_READ_LOCAL_SUPPORTED_FEATURES), (void *)&rp, &n); - printf("LOCAL SUPPORTED: %d %d %lu\n", e, rp.status, + printf("LOCAL SUPPORTED: %d %d %jx\n", e, rp.status, rp.le_features); return 0; @@ -250,7 +250,7 @@ le_read_supported_status(int s, int argc NG_HCI_OCF_LE_READ_SUPPORTED_STATUS), (void *)&rp, &n); - printf("LE_STATUS: %d %d %lx\n", e, rp.status, rp.le_status); + printf("LE_STATUS: %d %d %jx\n", e, rp.status, rp.le_status); return 0; } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r281688 - head/usr.sbin/bluetooth/hccontrol
Author: takawata Date: Sat Apr 18 09:08:47 2015 New Revision: 281688 URL: https://svnweb.freebsd.org/changeset/base/281688 Log: Fix Typo. Modified: head/usr.sbin/bluetooth/hccontrol/le.c Modified: head/usr.sbin/bluetooth/hccontrol/le.c == --- head/usr.sbin/bluetooth/hccontrol/le.c Sat Apr 18 08:01:12 2015 (r281687) +++ head/usr.sbin/bluetooth/hccontrol/le.c Sat Apr 18 09:08:47 2015 (r281688) @@ -247,7 +247,7 @@ le_read_supported_status(int s, int argc e = hci_simple_request(s, NG_HCI_OPCODE( NG_HCI_OGF_LE, - NG_HCI_OCF_LE_READ_SUPPORTED), + NG_HCI_OCF_LE_READ_SUPPORTED_STATUS), (void *)&rp, &n); printf("LE_STATUS: %d %d %lx\n", e, rp.status, rp.le_status); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r281683 - head/sys/netgraph/bluetooth/include
Author: takawata Date: Sat Apr 18 06:16:33 2015 New Revision: 281683 URL: https://svnweb.freebsd.org/changeset/base/281683 Log: Forgot to add default event mask definition. Modified: head/sys/netgraph/bluetooth/include/ng_hci.h Modified: head/sys/netgraph/bluetooth/include/ng_hci.h == --- head/sys/netgraph/bluetooth/include/ng_hci.hSat Apr 18 05:05:38 2015(r281682) +++ head/sys/netgraph/bluetooth/include/ng_hci.hSat Apr 18 06:16:33 2015(r281683) @@ -897,6 +897,8 @@ typedef struct { } __attribute__ ((packed)) ng_hci_set_event_mask_cp; typedef ng_hci_status_rp ng_hci_set_event_mask_rp; +#define NG_HCI_EVENT_MASK_DEFAULT 0x1fff +#define NG_HCI_EVENT_MASK_LE 0x2000 #define NG_HCI_OCF_RESET 0x0003 /* No command parameter(s) */ @@ -1454,6 +1456,7 @@ typedef struct { } __attribute__ ((packed)) ng_hci_le_set_event_mask_cp; typedef ng_hci_status_rp ng_hci_le_set_event_mask_rp; +#define NG_HCI_LE_EVENT_MASK_ALL 0x1f #define NG_HCI_OCF_LE_READ_BUFFER_SIZE 0x0002 /*No command parameter */ ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r281680 - head/usr.sbin/bluetooth/hccontrol
} + cp.simultaneous_le_host = (n &1); + + case 1: + if (sscanf(argv[0], "%d", &n) != 1 || (n != 0 && n != 1)){ + printf("ARGC1: %d\n", n); + return (USAGE); + } + + cp.le_supported_host = (n &1); + break; + + default: + return (USAGE); + } + + + /* send command */ + n = sizeof(rp); + if (hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_HC_BASEBAND, + NG_HCI_OCF_WRITE_LE_HOST_SUPPORTED), + (char const *) &cp, sizeof(cp), + (char *) &rp, &n) == ERROR) + return (ERROR); + + if (rp.status != 0x00) { + fprintf(stdout, "Status: %s [%#02x]\n", + hci_status2str(rp.status), rp.status); + return (FAILED); + } + + return (OK); +} + struct hci_command host_controller_baseband_commands[] = { { "reset", @@ -1873,6 +1945,17 @@ struct hci_command host_controller_baseb "\t0x03 - Optional Page Scan Mode III", &hci_write_page_scan_mode }, +{ +"read_le_host_supported_command", \ +"Read if this host is in le supported mode and stimulatenouse le supported mode", +&hci_read_le_host_supported_command, +}, +{ +"write_le_host_supported_command", \ +"write_le_host_supported_command le_host[0|1] stimultajeous_le[0|1]", +&hci_write_le_host_supported_command, +}, + { NULL, } }; Added: head/usr.sbin/bluetooth/hccontrol/le.c ====== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/bluetooth/hccontrol/le.c Sat Apr 18 04:53:17 2015 (r281680) @@ -0,0 +1,352 @@ +/* + * le.c + * + * Copyright (c) 2015 Takanori Watanabe + * 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. + * + * $Id: hccontrol.c,v 1.5 2003/09/05 00:38:24 max Exp $ + * $FreeBSD$ + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#define L2CAP_SOCKET_CHECKED +#include +#include "hccontrol.h" +static int le_set_scan_param(int s, int argc, char *argv[]); +static int le_set_scan_enable(int s, int argc, char *argv[]); +static int parse_param(int argc, char *argv[], char *buf, int *len); +static int le_set_scan_response(int s, int argc, char *argv[]); +static int le_read_supported_status(int s, int argc, char *argv[]); +static int le_read_local_supported_features(int s, int argc ,char *argv[]); +static int set_le_event_mask(int s, uint64_t mask); +static int set_event_mask(int s, uint64_t mask); +static int le_enable(int s, int argc, char *argv[]); + +static int le_set_scan_param(int s, int argc, char *argv[]) +{ + int type; + int interval; + int window; + int adrtype; + int policy; + + ng_hci_le_set_scan_parameters_cp cp; + ng_hci_le_set_scan_parameters_rp rp; + int e,n; + + if(argc != 5){ + return USAGE; + } + + if(strcmp(argv[0], "active")==0){ + type = 1; + }else if (strcmp(argv[0], "passive") == 0){ + type = 0; + }else{ + return USAGE; + } + + interval = (int)(atof(argv[1])/0.625); + interval = (interval < 4)? 4: interval; + window = (int)(atof(argv[2])/0.625); + window = (window < 4) ? 4 : interva
svn commit: r281468 - head/usr.sbin/bluetooth/hccontrol
Author: takawata Date: Sun Apr 12 15:08:41 2015 New Revision: 281468 URL: https://svnweb.freebsd.org/changeset/base/281468 Log: Accept LE event on hccontrol socket. Modified: head/usr.sbin/bluetooth/hccontrol/hccontrol.c Modified: head/usr.sbin/bluetooth/hccontrol/hccontrol.c == --- head/usr.sbin/bluetooth/hccontrol/hccontrol.c Sun Apr 12 14:38:18 2015(r281467) +++ head/usr.sbin/bluetooth/hccontrol/hccontrol.c Sun Apr 12 15:08:41 2015(r281468) @@ -144,6 +144,7 @@ socket_open(char const *node) bit_set(filter.event_mask, NG_HCI_EVENT_READ_CLOCK_OFFSET_COMPL - 1); bit_set(filter.event_mask, NG_HCI_EVENT_CON_PKT_TYPE_CHANGED - 1); bit_set(filter.event_mask, NG_HCI_EVENT_ROLE_CHANGE - 1); + bit_set(filter.event_mask, NG_HCI_EVENT_LE -1); if (setsockopt(s, SOL_HCI_RAW, SO_HCI_RAW_FILTER, (void * const) &filter, sizeof(filter)) < 0) ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r281467 - head/usr.sbin/bluetooth/hccontrol
Author: takawata Date: Sun Apr 12 14:38:18 2015 New Revision: 281467 URL: https://svnweb.freebsd.org/changeset/base/281467 Log: Add HCI/LMP revision information. Modified: head/usr.sbin/bluetooth/hccontrol/util.c Modified: head/usr.sbin/bluetooth/hccontrol/util.c == --- head/usr.sbin/bluetooth/hccontrol/util.cSun Apr 12 13:00:58 2015 (r281466) +++ head/usr.sbin/bluetooth/hccontrol/util.cSun Apr 12 14:38:18 2015 (r281467) @@ -152,7 +152,12 @@ hci_ver2str(int ver) /* 0x00 */ "Bluetooth HCI Specification 1.0B", /* 0x01 */ "Bluetooth HCI Specification 1.1", /* 0x02 */ "Bluetooth HCI Specification 1.2", - /* 0x03 */ "Bluetooth HCI Specification 2.0" + /* 0x03 */ "Bluetooth HCI Specification 2.0", + /* 0x04 */ "Bluetooth HCI Specification 2.1", + /* 0x05 */ "Bluetooth HCI Specification 3.0", + /* 0x06 */ "Bluetooth HCI Specification 4.0", + /* 0x07 */ "Bluetooth HCI Specification 4.1", + /* 0x08 */ "Bluetooth HCI Specification 4.2" }; return (ver >= SIZE(t)? "?" : t[ver]); @@ -165,7 +170,12 @@ hci_lmpver2str(int ver) /* 0x00 */ "Bluetooth LMP 1.0", /* 0x01 */ "Bluetooth LMP 1.1", /* 0x02 */ "Bluetooth LMP 1.2", - /* 0x03 */ "Bluetooth LMP 2.0" + /* 0x03 */ "Bluetooth LMP 2.0", + /* 0x04 */ "Bluetooth LMP 2.1", + /* 0x04 */ "Bluetooth LMP 3.0", + /* 0x04 */ "Bluetooth LMP 4.0", + /* 0x04 */ "Bluetooth LMP 4.1", + /* 0x04 */ "Bluetooth LMP 4.2" }; return (ver >= SIZE(t)? "?" : t[ver]); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r281210 - in head: lib/libbluetooth lib/libsdp usr.bin/bluetooth/bthost usr.bin/bluetooth/btsockstat usr.bin/bluetooth/rfcomm_sppd usr.sbin/bluetooth/bthidcontrol usr.sbin/bluetooth/bth...
Author: takawata Date: Tue Apr 7 16:48:23 2015 New Revision: 281210 URL: https://svnweb.freebsd.org/changeset/base/281210 Log: Check l2cap socket initialisation and define L2CAP_SOCKET_CHECKED This will fix build. Modified: head/lib/libbluetooth/bluetooth.c head/lib/libbluetooth/dev.c head/lib/libbluetooth/hci.c head/lib/libsdp/search.c head/lib/libsdp/service.c head/lib/libsdp/session.c head/lib/libsdp/util.c head/usr.bin/bluetooth/bthost/bthost.c head/usr.bin/bluetooth/btsockstat/btsockstat.c head/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sdp.c head/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.c head/usr.sbin/bluetooth/bthidcontrol/bthidcontrol.c head/usr.sbin/bluetooth/bthidcontrol/hid.c head/usr.sbin/bluetooth/bthidcontrol/sdp.c head/usr.sbin/bluetooth/bthidd/bthidd.c head/usr.sbin/bluetooth/bthidd/client.c head/usr.sbin/bluetooth/bthidd/hid.c head/usr.sbin/bluetooth/bthidd/kbd.c head/usr.sbin/bluetooth/bthidd/lexer.l head/usr.sbin/bluetooth/bthidd/parser.y head/usr.sbin/bluetooth/bthidd/server.c head/usr.sbin/bluetooth/bthidd/session.c head/usr.sbin/bluetooth/btpand/bnep.c head/usr.sbin/bluetooth/btpand/btpand.c head/usr.sbin/bluetooth/btpand/channel.c head/usr.sbin/bluetooth/btpand/client.c head/usr.sbin/bluetooth/btpand/event.c head/usr.sbin/bluetooth/btpand/packet.c head/usr.sbin/bluetooth/btpand/sdp.c head/usr.sbin/bluetooth/btpand/server.c head/usr.sbin/bluetooth/btpand/tap.c head/usr.sbin/bluetooth/hccontrol/hccontrol.c head/usr.sbin/bluetooth/hccontrol/host_controller_baseband.c head/usr.sbin/bluetooth/hccontrol/info.c head/usr.sbin/bluetooth/hccontrol/link_control.c head/usr.sbin/bluetooth/hccontrol/link_policy.c head/usr.sbin/bluetooth/hccontrol/node.c head/usr.sbin/bluetooth/hccontrol/util.c head/usr.sbin/bluetooth/hcsecd/hcsecd.c head/usr.sbin/bluetooth/hcsecd/parser.y head/usr.sbin/bluetooth/l2control/l2cap.c head/usr.sbin/bluetooth/l2control/l2control.c head/usr.sbin/bluetooth/l2ping/l2ping.c head/usr.sbin/bluetooth/rfcomm_pppd/rfcomm_pppd.c head/usr.sbin/bluetooth/sdpcontrol/sdpcontrol.c head/usr.sbin/bluetooth/sdpcontrol/search.c head/usr.sbin/bluetooth/sdpd/bgd.c head/usr.sbin/bluetooth/sdpd/dun.c head/usr.sbin/bluetooth/sdpd/ftrn.c head/usr.sbin/bluetooth/sdpd/gn.c head/usr.sbin/bluetooth/sdpd/irmc.c head/usr.sbin/bluetooth/sdpd/irmc_command.c head/usr.sbin/bluetooth/sdpd/lan.c head/usr.sbin/bluetooth/sdpd/main.c head/usr.sbin/bluetooth/sdpd/nap.c head/usr.sbin/bluetooth/sdpd/opush.c head/usr.sbin/bluetooth/sdpd/panu.c head/usr.sbin/bluetooth/sdpd/profile.c head/usr.sbin/bluetooth/sdpd/provider.c head/usr.sbin/bluetooth/sdpd/sar.c head/usr.sbin/bluetooth/sdpd/scr.c head/usr.sbin/bluetooth/sdpd/sd.c head/usr.sbin/bluetooth/sdpd/server.c head/usr.sbin/bluetooth/sdpd/sp.c head/usr.sbin/bluetooth/sdpd/srr.c head/usr.sbin/bluetooth/sdpd/ssar.c head/usr.sbin/bluetooth/sdpd/ssr.c head/usr.sbin/bluetooth/sdpd/sur.c head/usr.sbin/bluetooth/sdpd/uuid.c Modified: head/lib/libbluetooth/bluetooth.c == --- head/lib/libbluetooth/bluetooth.c Tue Apr 7 15:56:08 2015 (r281209) +++ head/lib/libbluetooth/bluetooth.c Tue Apr 7 16:48:23 2015 (r281210) @@ -30,7 +30,7 @@ * $Id: bluetooth.c,v 1.3 2003/05/20 23:04:30 max Exp $ * $FreeBSD$ */ - +#define L2CAP_SOCKET_CHECKED #include #include #include Modified: head/lib/libbluetooth/dev.c == --- head/lib/libbluetooth/dev.c Tue Apr 7 15:56:08 2015(r281209) +++ head/lib/libbluetooth/dev.c Tue Apr 7 16:48:23 2015(r281210) @@ -30,6 +30,7 @@ * $FreeBSD$ */ +#define L2CAP_SOCKET_CHECKED #include #include #include Modified: head/lib/libbluetooth/hci.c == --- head/lib/libbluetooth/hci.c Tue Apr 7 15:56:08 2015(r281209) +++ head/lib/libbluetooth/hci.c Tue Apr 7 16:48:23 2015(r281210) @@ -31,6 +31,7 @@ */ #include +#define L2CAP_SOCKET_CHECKED #include #include #include Modified: head/lib/libsdp/search.c == --- head/lib/libsdp/search.cTue Apr 7 15:56:08 2015(r281209) +++ head/lib/libsdp/search.cTue Apr 7 16:48:23 2015(r281210) @@ -32,6 +32,7 @@ #include #include #include +#define L2CAP_SOCKET_CHECKED #include #include #include Modified: head/lib/libsdp/service.c == --- head/lib/libsdp/service.c Tue Apr 7 15:56:08 2015(r281209) +++ head/lib/libsdp/service.c Tue Apr 7 16:48:23 2015(r281210) @@ -32,6 +32,7 @@ #include #include #include +#define L2CAP_SOCKET_CHECKED #include #include #include Modifie
svn commit: r281198 - in head/sys/netgraph/bluetooth: hci include l2cap socket
Author: takawata Date: Tue Apr 7 10:22:56 2015 New Revision: 281198 URL: https://svnweb.freebsd.org/changeset/base/281198 Log: Initial Bluetooth LE support. Note that sockaddr_l2cap structure is changed , check socket address to initialize new structure member and define L2CAP_SOCKET_CHECKED before including ng_btsocket.h Differential Revision:https://reviews.freebsd.org/D2021 Reviewed by:emax Modified: head/sys/netgraph/bluetooth/hci/ng_hci_cmds.c head/sys/netgraph/bluetooth/hci/ng_hci_evnt.c head/sys/netgraph/bluetooth/hci/ng_hci_main.c head/sys/netgraph/bluetooth/hci/ng_hci_misc.c head/sys/netgraph/bluetooth/hci/ng_hci_misc.h head/sys/netgraph/bluetooth/hci/ng_hci_ulpi.c head/sys/netgraph/bluetooth/hci/ng_hci_var.h head/sys/netgraph/bluetooth/include/ng_btsocket.h head/sys/netgraph/bluetooth/include/ng_btsocket_l2cap.h head/sys/netgraph/bluetooth/include/ng_hci.h head/sys/netgraph/bluetooth/include/ng_l2cap.h head/sys/netgraph/bluetooth/l2cap/ng_l2cap_cmds.c head/sys/netgraph/bluetooth/l2cap/ng_l2cap_cmds.h head/sys/netgraph/bluetooth/l2cap/ng_l2cap_evnt.c head/sys/netgraph/bluetooth/l2cap/ng_l2cap_llpi.c head/sys/netgraph/bluetooth/l2cap/ng_l2cap_llpi.h head/sys/netgraph/bluetooth/l2cap/ng_l2cap_misc.c head/sys/netgraph/bluetooth/l2cap/ng_l2cap_misc.h head/sys/netgraph/bluetooth/l2cap/ng_l2cap_ulpi.c head/sys/netgraph/bluetooth/l2cap/ng_l2cap_var.h head/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c head/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c head/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap_raw.c Modified: head/sys/netgraph/bluetooth/hci/ng_hci_cmds.c == --- head/sys/netgraph/bluetooth/hci/ng_hci_cmds.c Tue Apr 7 09:52:14 2015(r281197) +++ head/sys/netgraph/bluetooth/hci/ng_hci_cmds.c Tue Apr 7 10:22:56 2015(r281198) @@ -71,11 +71,15 @@ static int process_status_params (ng_hci_unit_p, u_int16_t, struct mbuf *, struct mbuf *); static int process_testing_params (ng_hci_unit_p, u_int16_t, struct mbuf *, struct mbuf *); +static int process_le_params + (ng_hci_unit_p, u_int16_t, struct mbuf *, struct mbuf *); static int process_link_control_status (ng_hci_unit_p, ng_hci_command_status_ep *, struct mbuf *); static int process_link_policy_status (ng_hci_unit_p, ng_hci_command_status_ep *, struct mbuf *); +static int process_le_status + (ng_hci_unit_p, ng_hci_command_status_ep *, struct mbuf *); /* * Send HCI command to the driver. @@ -222,7 +226,10 @@ ng_hci_process_command_complete(ng_hci_u error = process_testing_params(unit, NG_HCI_OCF(ep->opcode), cp, e); break; - + case NG_HCI_OGF_LE: + error = process_le_params(unit, + NG_HCI_OCF(ep->opcode), cp, e); + break; case NG_HCI_OGF_BT_LOGO: case NG_HCI_OGF_VENDOR: NG_FREE_M(cp); @@ -294,7 +301,9 @@ ng_hci_process_command_status(ng_hci_uni case NG_HCI_OGF_LINK_POLICY: error = process_link_policy_status(unit, ep, cp); break; - + case NG_HCI_OGF_LE: + error = process_le_status(unit, ep, cp); + break; case NG_HCI_OGF_BT_LOGO: case NG_HCI_OGF_VENDOR: NG_FREE_M(cp); @@ -604,6 +613,8 @@ process_hc_baseband_params(ng_hci_unit_p case NG_HCI_OCF_READ_LOCAL_NAME: case NG_HCI_OCF_READ_UNIT_CLASS: case NG_HCI_OCF_WRITE_UNIT_CLASS: + case NG_HCI_OCF_READ_LE_HOST_SUPPORTED: + case NG_HCI_OCF_WRITE_LE_HOST_SUPPORTED: /* These do not need post processing */ break; @@ -796,6 +807,132 @@ process_testing_params(ng_hci_unit_p uni return (error); } /* process_testing_params */ +/* + * Process LE command return parameters + */ + +static int +process_le_params(ng_hci_unit_p unit, u_int16_t ocf, + struct mbuf *mcp, struct mbuf *mrp) +{ + int error = 0; + + switch (ocf){ + case NG_HCI_OCF_LE_SET_EVENT_MASK: + case NG_HCI_OCF_LE_READ_BUFFER_SIZE: + case NG_HCI_OCF_LE_READ_LOCAL_SUPPORTED_FEATURES: + case NG_HCI_OCF_LE_SET_RANDOM_ADDRESS: + case NG_HCI_OCF_LE_SET_ADVERTISING_PARAMETERS: + case NG_HCI_OCF_LE_READ_ADVERTISING_CHANNEL_TX_POWER: + case NG_HCI_OCF_LE_SET_ADVERTISING_DATA: + case NG_HCI_OCF_LE_SET_SCAN_RESPONSE_DATA: + case NG_HCI_OCF_LE_SET_ADVERTISE_ENABLE: + case NG_HCI_OCF_LE_SET_SCAN_PARAMETERS: + case NG_HCI_OCF_LE_SET_SCAN_ENABLE: + case NG_HCI_OCF_LE_CREATE_CONNECTION_CANCEL: + case NG_HCI_OCF_LE_CLEAR_WHITE_LIST: + case NG_HCI_OCF_LE_READ_WHITE_LIST_SIZE: + case NG_HCI_OCF_LE
svn commit: r263859 - head/sys/x86/acpica
Author: takawata Date: Fri Mar 28 02:38:14 2014 New Revision: 263859 URL: http://svnweb.freebsd.org/changeset/base/263859 Log: Change default logic to CONFORM because this routine is shared with SCI polarity setting. Reviewed by: jhb Modified: head/sys/x86/acpica/madt.c Modified: head/sys/x86/acpica/madt.c == --- head/sys/x86/acpica/madt.c Fri Mar 28 02:06:51 2014(r263858) +++ head/sys/x86/acpica/madt.c Fri Mar 28 02:38:14 2014(r263859) @@ -298,6 +298,9 @@ interrupt_polarity(UINT16 IntiFlags, UIN { switch (IntiFlags & ACPI_MADT_POLARITY_MASK) { + default: + printf("WARNING: Bogus Interrupt Polarity. Assume CONFORMS"); + /* FALLTHROUGH*/ case ACPI_MADT_POLARITY_CONFORMS: if (Source == AcpiGbl_FADT.SciInterrupt) return (INTR_POLARITY_LOW); @@ -306,11 +309,8 @@ interrupt_polarity(UINT16 IntiFlags, UIN case ACPI_MADT_POLARITY_ACTIVE_HIGH: return (INTR_POLARITY_HIGH); case ACPI_MADT_POLARITY_ACTIVE_LOW: - break; - default: - printf("WARNING: Bogus Interrupt Polarity. Assume POLALITY LOW"); + return (INTR_POLARITY_LOW); } - return (INTR_POLARITY_LOW); } static enum intr_trigger @@ -318,6 +318,9 @@ interrupt_trigger(UINT16 IntiFlags, UINT { switch (IntiFlags & ACPI_MADT_TRIGGER_MASK) { + default: + printf("WARNING: Bogus Interrupt Trigger Mode. Assume CONFORMS."); + /*FALLTHROUGH*/ case ACPI_MADT_TRIGGER_CONFORMS: if (Source == AcpiGbl_FADT.SciInterrupt) return (INTR_TRIGGER_LEVEL); @@ -326,13 +329,8 @@ interrupt_trigger(UINT16 IntiFlags, UINT case ACPI_MADT_TRIGGER_EDGE: return (INTR_TRIGGER_EDGE); case ACPI_MADT_TRIGGER_LEVEL: - break; - default: - printf("WARNING: Bogus Interrupt Trigger Mode. Assume Level trigger."); - - break; + return (INTR_TRIGGER_LEVEL); } - return (INTR_TRIGGER_LEVEL); } /* ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r263795 - head/sys/x86/acpica
Author: takawata Date: Thu Mar 27 06:36:38 2014 New Revision: 263795 URL: http://svnweb.freebsd.org/changeset/base/263795 Log: Strict value checking will cause problem. Bay trail DN2820FYKH is supported on Linux but does not work on FreeBSD. This behaviour is bug-compatible with Linux-3.13.5. References: http://d.hatena.ne.jp/syuu1228/20140326 http://lxr.linux.no/linux+v3.13.5/arch/x86/kernel/acpi/boot.c#L1094 Submitted by: syuu Modified: head/sys/x86/acpica/madt.c Modified: head/sys/x86/acpica/madt.c == --- head/sys/x86/acpica/madt.c Thu Mar 27 06:08:07 2014(r263794) +++ head/sys/x86/acpica/madt.c Thu Mar 27 06:36:38 2014(r263795) @@ -306,10 +306,11 @@ interrupt_polarity(UINT16 IntiFlags, UIN case ACPI_MADT_POLARITY_ACTIVE_HIGH: return (INTR_POLARITY_HIGH); case ACPI_MADT_POLARITY_ACTIVE_LOW: - return (INTR_POLARITY_LOW); + break; default: - panic("Bogus Interrupt Polarity"); + printf("WARNING: Bogus Interrupt Polarity. Assume POLALITY LOW"); } + return (INTR_POLARITY_LOW); } static enum intr_trigger @@ -325,10 +326,13 @@ interrupt_trigger(UINT16 IntiFlags, UINT case ACPI_MADT_TRIGGER_EDGE: return (INTR_TRIGGER_EDGE); case ACPI_MADT_TRIGGER_LEVEL: - return (INTR_TRIGGER_LEVEL); + break; default: - panic("Bogus Interrupt Trigger Mode"); + printf("WARNING: Bogus Interrupt Trigger Mode. Assume Level trigger."); + + break; } + return (INTR_TRIGGER_LEVEL); } /* ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r263794 - head/sys/x86/acpica
Author: takawata Date: Thu Mar 27 06:08:07 2014 New Revision: 263794 URL: http://svnweb.freebsd.org/changeset/base/263794 Log: To check polarity, check ACPI_MADT_POLARITY_CONFORMS, instead of ACPI_MADT_TRIGGER_CONFORMS. PR:amd64/188010 Submitted by: syuu Modified: head/sys/x86/acpica/madt.c Modified: head/sys/x86/acpica/madt.c == --- head/sys/x86/acpica/madt.c Thu Mar 27 04:30:07 2014(r263793) +++ head/sys/x86/acpica/madt.c Thu Mar 27 06:08:07 2014(r263794) @@ -492,7 +492,7 @@ madt_parse_nmi(ACPI_MADT_NMI_SOURCE *nmi if (!(nmi->IntiFlags & ACPI_MADT_TRIGGER_CONFORMS)) ioapic_set_triggermode(ioapic, pin, interrupt_trigger(nmi->IntiFlags, 0)); - if (!(nmi->IntiFlags & ACPI_MADT_TRIGGER_CONFORMS)) + if (!(nmi->IntiFlags & ACPI_MADT_POLARITY_CONFORMS)) ioapic_set_polarity(ioapic, pin, interrupt_polarity(nmi->IntiFlags, 0)); } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r250364 - head/share/man/man4
Author: takawata Date: Wed May 8 13:26:17 2013 New Revision: 250364 URL: http://svnweb.freebsd.org/changeset/base/250364 Log: Manual page for acpi_rapidstart(4) driver. > Description of fields to fill in above: 76 columns --| > PR:If a GNATS PR is affected by the change. > Submitted by: If someone else sent in the change. > Reviewed by: If someone else reviewed your modification. > Approved by: If you needed approval for this commit. > Obtained from: If the change is from a third party. > MFC after: N [day[s]|week[s]|month[s]]. Request a reminder email. > Security: Vulnerability reference (one per line) or description. > Empty fields above will be automatically removed. AM acpi_rapidstart.4 Added: head/share/man/man4/acpi_rapidstart.4 (contents, props changed) Added: head/share/man/man4/acpi_rapidstart.4 == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/acpi_rapidstart.4 Wed May 8 13:26:17 2013 (r250364) @@ -0,0 +1,82 @@ +.\" Copyright (c) 2013 Takanori Watanabe +.\" 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$ +.\" +.Dd May 8, 2013 +.Dt ACPI_RAPIDSTART 4 +.Os +.Sh NAME +.Nm acpi_rapidstart +.Nd "Intel rapid start technology ACPI driver" +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following line in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device acpi_rapidstart" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +acpi_rapidstart_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for Intel Rapid Start technology ACPI device interface. +Note that this is only for ACPI device interface . This has _CID PNP0C02 so +should be loaded in boot time to avoid attaching acpi_sysresource driver. + +.Sh SYSCTLS +The following sysctl nodes are currently implemented: +.Bl -tag -width indent +.It Va dev.acpi_rapidstart.0.ffs +Rapid start flag. +It is a bitwise OR of the following: +.Pp +.Bl -tag -width indent-two -compact +.It Li 1 +Enter Fast Flash Standby in RTC wake. +.It Li 2 +Enter Fast Flash Standby in Critical Battery Wake enable +.El +.It Va dev.acpi_rapidstart.0.ftv +Fast Flash Standby timer value in minutes. +.El +.Sh SEE ALSO +.Xr acpi 4 , +.Xr sysctl 8 +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 10.0 . +.Sh AUTHORS +The +.Nm +driver was written by +.An Takanori Watanabe Aq takaw...@freebsd.org . ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r250363 - in head/sys: dev/acpi_support modules/acpi/acpi_rapidstart
Author: takawata Date: Wed May 8 12:53:21 2013 New Revision: 250363 URL: http://svnweb.freebsd.org/changeset/base/250363 Log: A driver for Intel Rapid Start Technology ACPI device. Note that it is just for 'Advanced' configuration for Rapid start technology. Added: head/sys/dev/acpi_support/acpi_rapidstart.c (contents, props changed) head/sys/modules/acpi/acpi_rapidstart/ head/sys/modules/acpi/acpi_rapidstart/Makefile (contents, props changed) Added: head/sys/dev/acpi_support/acpi_rapidstart.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/acpi_support/acpi_rapidstart.c Wed May 8 12:53:21 2013 (r250363) @@ -0,0 +1,133 @@ +/*- + * Copyright (c) 2013 Takanori Watanabe + * 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 "opt_acpi.h" +#include +#include +#include + +#include + +#include "acpi_if.h" +#include +#include +#include +static int sysctl_acpi_rapidstart_gen_handler(SYSCTL_HANDLER_ARGS); + + +static struct acpi_rapidstart_name_list +{ + char *nodename; + char *getmethod; + char *setmethod; + char *comment; +} acpi_rapidstart_oids[] ={ + {"ffs","GFFS","SFFS","Flash Fast Store Flag"}, + {"ftv","GFTV","SFTV","Time value"}, + {NULL, NULL, NULL, NULL} +}; + +struct acpi_rapidstart_softc { + struct sysctl_ctx_list *sysctl_ctx; + struct sysctl_oid *sysctl_tree; + +}; +static char*rapidstart_ids[] = {"INT3392", NULL}; +static int +acpi_rapidstart_probe(device_t dev) +{ + if (acpi_disabled("rapidstart") || + ACPI_ID_PROBE(device_get_parent(dev), dev, rapidstart_ids) == NULL || + device_get_unit(dev) != 0) + return (ENXIO); + + device_set_desc(dev, "Intel Rapid Start ACPI device"); + + return (0); + +} + +static int +acpi_rapidstart_attach(device_t dev) +{ + struct acpi_rapidstart_softc *sc; + int i; + + sc = device_get_softc(dev); + + sc->sysctl_ctx = device_get_sysctl_ctx(dev); + sc->sysctl_tree = device_get_sysctl_tree(dev); + for (i = 0 ; acpi_rapidstart_oids[i].nodename != NULL; i++){ + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + i, acpi_rapidstart_oids[i].nodename , CTLTYPE_INT | + ((acpi_rapidstart_oids[i].setmethod)? CTLFLAG_RW: CTLFLAG_RD), + dev, i, sysctl_acpi_rapidstart_gen_handler, "I", + acpi_rapidstart_oids[i].comment); + } + return (0); +} + +static int +sysctl_acpi_rapidstart_gen_handler(SYSCTL_HANDLER_ARGS) +{ + device_tdev = arg1; + int function = oidp->oid_arg2; + int error = 0, val; + + acpi_GetInteger(acpi_get_handle(dev), + acpi_rapidstart_oids[function].getmethod, &val); + error = sysctl_handle_int(oidp, &val, 0, req); + if (error || !req->newptr || !acpi_rapidstart_oids[function].setmethod) + return (error); + acpi_SetInteger(acpi_get_handle(dev), + acpi_rapidstart_oids[function].setmethod, val); + return (0); +} + +static device_method_t acpi_rapidstart_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, acpi_rapidstart_probe), + DEVMETHOD(device_attach, acpi_rapidstart_att
svn commit: r238288 - head/usr.sbin/acpi/acpidump
Author: takawata Date: Mon Jul 9 09:38:53 2012 New Revision: 238288 URL: http://svn.freebsd.org/changeset/base/238288 Log: Add range and table revision checking to avoid abend. PR:bin/169707 Submitted by:Dan Lukes MFC after:3 days. Modified: head/usr.sbin/acpi/acpidump/acpi.c Modified: head/usr.sbin/acpi/acpidump/acpi.c == --- head/usr.sbin/acpi/acpidump/acpi.c Mon Jul 9 09:24:46 2012 (r238287) +++ head/usr.sbin/acpi/acpidump/acpi.c Mon Jul 9 09:38:53 2012 (r238288) @@ -654,16 +654,24 @@ acpi_handle_tcpa(ACPI_TABLE_HEADER *sdp) printf(END_COMMENT); return; } + if(sdp->Revision == 1){ + printf("\tOLD TCPA spec log found. Dumping not supported.\n"); + printf(END_COMMENT); + return; + } vaddr = (unsigned char *)acpi_map_physical(paddr, len); vend = vaddr + len; while (vaddr != NULL) { - if (vaddr + sizeof(struct TCPAevent) >= vend) + if ((vaddr + sizeof(struct TCPAevent) >= vend)|| + (vaddr + sizeof(struct TCPAevent) < vaddr)) break; event = (struct TCPAevent *)(void *)vaddr; if (vaddr + event->event_size >= vend) break; + if (vaddr + event->event_size < vaddr) + break; if (event->event_type == 0 && event->event_size == 0) break; #if 0 ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r237605 - in head/sys: dev/nand modules/nand
Author: takawata Date: Tue Jun 26 18:08:03 2012 New Revision: 237605 URL: http://svn.freebsd.org/changeset/base/237605 Log: Add nand core module and module dependency information. Reviewed by:gber Added: head/sys/modules/nand/ head/sys/modules/nand/Makefile (contents, props changed) Modified: head/sys/dev/nand/nand.c head/sys/dev/nand/nandsim.c Modified: head/sys/dev/nand/nand.c == --- head/sys/dev/nand/nand.cTue Jun 26 16:45:18 2012(r237604) +++ head/sys/dev/nand/nand.cTue Jun 26 18:08:03 2012(r237605) @@ -830,3 +830,5 @@ nand_erase_blocks(struct nand_chip *chip return (err); } + +MODULE_VERSION(nand, 1); Modified: head/sys/dev/nand/nandsim.c == --- head/sys/dev/nand/nandsim.c Tue Jun 26 16:45:18 2012(r237604) +++ head/sys/dev/nand/nandsim.c Tue Jun 26 18:08:03 2012(r237605) @@ -663,3 +663,5 @@ nandsim_modevent(module_t mod __unused, DEV_MODULE(nandsim, nandsim_modevent, NULL); MODULE_VERSION(nandsim, 1); +MODULE_DEPEND(nandsim, nand, 1, 1, 1); +MODULE_DEPEND(nandsim, alq, 1, 1, 1); Added: head/sys/modules/nand/Makefile == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/nand/Makefile Tue Jun 26 18:08:03 2012 (r237605) @@ -0,0 +1,13 @@ +# $FreeBSD$ + +.PATH: ${.CURDIR}/../../dev/nand + +KMOD = nand +SRCS= nand.c nand_bbt.c nand_cdev.c nand_generic.c nand_geom.c \ + nand_id.c nandbus.c nandbus_if.c nand_if.c nfc_if.c \ + nand_if.h device_if.h bus_if.h nfc_if.h nandbus_if.h + +MFILES=kern/bus_if.m kern/device_if.m dev/nand/nfc_if.m \ + dev/nand/nand_if.m dev/nand/nandbus_if.m + +.include ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r211278 - head/usr.sbin/acpi/acpidump
Author: takawata Date: Fri Aug 13 09:58:17 2010 New Revision: 211278 URL: http://svn.freebsd.org/changeset/base/211278 Log: use uintmax_t instead of uint64_t. Pointed out by: des. Modified: head/usr.sbin/acpi/acpidump/acpi.c Modified: head/usr.sbin/acpi/acpidump/acpi.c == --- head/usr.sbin/acpi/acpidump/acpi.c Fri Aug 13 07:34:41 2010 (r211277) +++ head/usr.sbin/acpi/acpidump/acpi.c Fri Aug 13 09:58:17 2010 (r211278) @@ -622,7 +622,7 @@ acpi_handle_tcpa(ACPI_TABLE_HEADER *sdp) { struct TCPAbody *tcpa; struct TCPAevent *event; - uint64_t len, paddr; + uintmax_t len, paddr; unsigned char *vaddr = NULL; unsigned char *vend = NULL; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r211270 - head/sys/modules/tpm
In message <201008130400.o7d40zwp087...@svn.freebsd.org>, Takanori Watanabe : >Author: takawata >Date: Fri Aug 13 04:00:35 2010 >New Revision: 211270 >URL: http://svn.freebsd.org/changeset/base/211270 > >Log: > Hook tpm.4 manual to build. > Wrong directory. Real change was committed separately. This is cosmetic change to separate core and bus frontend, because I heard some embedded platform also uses TPM. ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r211271 - head/share/man/man4
Author: takawata Date: Fri Aug 13 05:01:44 2010 New Revision: 211271 URL: http://svn.freebsd.org/changeset/base/211271 Log: Hook tpm.4 manual to hook. Modified: head/share/man/man4/Makefile Modified: head/share/man/man4/Makefile == --- head/share/man/man4/MakefileFri Aug 13 04:00:35 2010 (r211270) +++ head/share/man/man4/MakefileFri Aug 13 05:01:44 2010 (r211271) @@ -419,6 +419,7 @@ MAN=aac.4 \ ti.4 \ tl.4 \ tnt4882.4 \ + ${_tpm.4} \ trm.4 \ tty.4 \ tun.4 \ @@ -670,6 +671,7 @@ _padlock.4= padlock.4 _rr232x.4= rr232x.4 _speaker.4=speaker.4 _spkr.4= spkr.4 +_tpm.4=tpm.4 _urtw.4= urtw.4 _wpi.4=wpi.4 ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r211270 - head/sys/modules/tpm
Author: takawata Date: Fri Aug 13 04:00:35 2010 New Revision: 211270 URL: http://svn.freebsd.org/changeset/base/211270 Log: Hook tpm.4 manual to build. Modified: head/sys/modules/tpm/Makefile Modified: head/sys/modules/tpm/Makefile == --- head/sys/modules/tpm/Makefile Fri Aug 13 03:17:33 2010 (r211269) +++ head/sys/modules/tpm/Makefile Fri Aug 13 04:00:35 2010 (r211270) @@ -3,7 +3,9 @@ .PATH: ${.CURDIR}/../../dev/tpm KMOD= tpm -SRCS= tpm.c tpm_isa.c tpm_acpi.c isa_if.h opt_acpi.h acpi_if.h \ - bus_if.h device_if.h + +SRCS= tpm.c bus_if.h device_if.h +#Bus specific stuff. +SRCS+= tpm_isa.c tpm_acpi.c isa_if.h opt_acpi.h acpi_if.h .include ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r211252 - head/usr.sbin/acpi/acpidump
Author: takawata Date: Fri Aug 13 00:45:30 2010 New Revision: 211252 URL: http://svn.freebsd.org/changeset/base/211252 Log: Fix build on amd64 and ia64. Modified: head/usr.sbin/acpi/acpidump/acpi.c Modified: head/usr.sbin/acpi/acpidump/acpi.c == --- head/usr.sbin/acpi/acpidump/acpi.c Fri Aug 13 00:21:32 2010 (r211251) +++ head/usr.sbin/acpi/acpidump/acpi.c Fri Aug 13 00:45:30 2010 (r211252) @@ -40,7 +40,6 @@ #include #include #include -#include #include "acpidump.h" @@ -623,7 +622,7 @@ acpi_handle_tcpa(ACPI_TABLE_HEADER *sdp) { struct TCPAbody *tcpa; struct TCPAevent *event; - u_int64_t len, paddr; + uint64_t len, paddr; unsigned char *vaddr = NULL; unsigned char *vend = NULL; @@ -647,7 +646,7 @@ acpi_handle_tcpa(ACPI_TABLE_HEADER *sdp) printf(END_COMMENT); return; } - printf("\tClass %d Base Address 0x%jx Length %" PRIu64 "\n\n", + printf("\tClass %u Base Address 0x%jx Length %ju\n\n", tcpa->platform_class, paddr, len); if (len == 0) { @@ -662,7 +661,7 @@ acpi_handle_tcpa(ACPI_TABLE_HEADER *sdp) while (vaddr != NULL) { if (vaddr + sizeof(struct TCPAevent) >= vend) break; - event = (struct TCPAevent *)vaddr; + event = (struct TCPAevent *)(void *)vaddr; if (vaddr + event->event_size >= vend) break; if (event->event_type == 0 && event->event_size == 0) ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r211221 - head/usr.sbin/acpi/acpidump
Author: takawata Date: Thu Aug 12 13:58:46 2010 New Revision: 211221 URL: http://svn.freebsd.org/changeset/base/211221 Log: Fix breakage on 64bit architecture by using inttypes.h macro. Modified: head/usr.sbin/acpi/acpidump/acpi.c Modified: head/usr.sbin/acpi/acpidump/acpi.c == --- head/usr.sbin/acpi/acpidump/acpi.c Thu Aug 12 13:46:43 2010 (r211220) +++ head/usr.sbin/acpi/acpidump/acpi.c Thu Aug 12 13:58:46 2010 (r211221) @@ -40,6 +40,7 @@ #include #include #include +#include #include "acpidump.h" @@ -646,7 +647,7 @@ acpi_handle_tcpa(ACPI_TABLE_HEADER *sdp) printf(END_COMMENT); return; } - printf("\tClass %d Base Address 0x%jx Length %llu\n\n", + printf("\tClass %d Base Address 0x%jx Length %" PRIu64 "\n\n", tcpa->platform_class, paddr, len); if (len == 0) { ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r211219 - head/usr.sbin/acpi/acpidump
Author: takawata Date: Thu Aug 12 11:01:38 2010 New Revision: 211219 URL: http://svn.freebsd.org/changeset/base/211219 Log: Fix tindebox breakage about format warning. Modified: head/usr.sbin/acpi/acpidump/acpi.c Modified: head/usr.sbin/acpi/acpidump/acpi.c == --- head/usr.sbin/acpi/acpidump/acpi.c Thu Aug 12 11:00:45 2010 (r211218) +++ head/usr.sbin/acpi/acpidump/acpi.c Thu Aug 12 11:01:38 2010 (r211219) @@ -646,7 +646,7 @@ acpi_handle_tcpa(ACPI_TABLE_HEADER *sdp) printf(END_COMMENT); return; } - printf("\tClass %d Base Address 0x%jx Length %lld\n\n", + printf("\tClass %d Base Address 0x%jx Length %llu\n\n", tcpa->platform_class, paddr, len); if (len == 0) { ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r211204 - head/share/man/man4
Author: takawata Date: Thu Aug 12 01:08:50 2010 New Revision: 211204 URL: http://svn.freebsd.org/changeset/base/211204 Log: Fix copyright information. Modified: head/share/man/man4/tpm.4 Modified: head/share/man/man4/tpm.4 == --- head/share/man/man4/tpm.4 Thu Aug 12 00:55:35 2010(r211203) +++ head/share/man/man4/tpm.4 Thu Aug 12 01:08:50 2010(r211204) @@ -1,5 +1,5 @@ .\" -.\" Copyright (c) 2010 Hans-J +.\" Copyright (c) 2010 Hans-Joerg Hoexer .\" .\" Permission to use, copy, modify, and distribute this software for any .\" purpose with or without fee is hereby granted, provided that the above ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r211201 - in head: share/man/man4 sys/conf sys/dev/tpm sys/modules sys/modules/tpm
Author: takawata Date: Thu Aug 12 00:16:18 2010 New Revision: 211201 URL: http://svn.freebsd.org/changeset/base/211201 Log: Add tpm(4) driver for Trusted Platform Module. You may want to look at http://bsssd.sourceforge.net/ . Submitted by: Hans-Joerg Hoexer Added: head/share/man/man4/tpm.4 (contents, props changed) head/sys/dev/tpm/ head/sys/dev/tpm/tpm.c (contents, props changed) head/sys/dev/tpm/tpm_acpi.c (contents, props changed) head/sys/dev/tpm/tpm_isa.c (contents, props changed) head/sys/dev/tpm/tpmvar.h (contents, props changed) head/sys/modules/tpm/ head/sys/modules/tpm/Makefile (contents, props changed) Modified: head/sys/conf/files.i386 head/sys/modules/Makefile Added: head/share/man/man4/tpm.4 == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/tpm.4 Thu Aug 12 00:16:18 2010(r211201) @@ -0,0 +1,74 @@ +.\" +.\" Copyright (c) 2010 Hans-J +.\" +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +.\" +.\" $FreeBSD$ +.\" +.Dd March 8, 2010 +.Dt TPM 4 +.Os +.Sh NAME +.Nm tpm +.Nd Trusted Platform Module +.Sh SYNOPSIS +.Cd "device tpm" +.Pp +In +.Pa /boot/device.hints : +.Cd hint.tpm.0.at="isa" +.Cd hint.tpm.0.maddr="0xfed4" +.Cd hint.tpm.0.msize="0x5000" +.Cd hint.tpm.1.at="isa" +.Cd hint.tpm.1.maddr="0xfed4" +.Cd hint.tpm.1.msize="0x1000" +.Sh DESCRIPTION +The +.Nm +driver provides support for various trusted platfrom modules (TPM) that can +store cryptographic keys. +.Pp +Supported modules: +.Pp +.Bl -bullet -compact -offset indent +.It +Atmel 97SC3203 +.It +Broadcom BCM0102 +.It +Infineon IFX SLD 9630 TT 1.1 and IFX SLB 9635 TT 1.2 +.It +Intel INTC0102 +.It +Sinosun SNS SSX35 +.It +STM ST19WP18 +.It +Winbond WEC WPCT200 +.El +.Pp +The driver can be configured to use an IRQ by providing a free ISA +interrupt vector in +.Pa /boot/device.hints . +.Sh SEE ALSO +.Xr intro 4 , +.Xr files.conf 5, +.Xr config 8 +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Michael Shalayeff +and +.An Hans-Joerg Hoexer . Modified: head/sys/conf/files.i386 == --- head/sys/conf/files.i386Wed Aug 11 23:59:21 2010(r211200) +++ head/sys/conf/files.i386Thu Aug 12 00:16:18 2010(r211201) @@ -231,6 +231,9 @@ dev/syscons/scterm-teken.c optional sc dev/syscons/scvesactl.coptional sc vga vesa dev/syscons/scvgarndr.coptional sc vga dev/syscons/scvtb.coptional sc +dev/tpm/tpm.c optional tpm +dev/tpm/tpm_acpi.c optional tpm acpi +dev/tpm/tpm_isa.c optional tpm isa dev/uart/uart_cpu_i386.c optional uart dev/acpica/acpi_if.m standard dev/acpi_support/acpi_wmi_if.m standard Added: head/sys/dev/tpm/tpm.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/tpm/tpm.c Thu Aug 12 00:16:18 2010(r211201) @@ -0,0 +1,1492 @@ +/* + * Copyright (c) 2008, 2009 Michael Shalayeff + * Copyright (c) 2009, 2010 Hans-Joerg Hoexer + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* #define TPM_DEBUG */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include + +#ifdef __FreeBSD__ +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include +#incl
svn commit: r211196 - head/usr.sbin/acpi/acpidump
Author: takawata Date: Wed Aug 11 23:21:25 2010 New Revision: 211196 URL: http://svn.freebsd.org/changeset/base/211196 Log: Add TCG ACPI spec table (TCPA) support. Submitted by: hans-joerg_hoe...@genua.de Modified: head/usr.sbin/acpi/acpidump/acpi.c head/usr.sbin/acpi/acpidump/acpidump.h Modified: head/usr.sbin/acpi/acpidump/acpi.c == --- head/usr.sbin/acpi/acpidump/acpi.c Wed Aug 11 22:44:10 2010 (r211195) +++ head/usr.sbin/acpi/acpidump/acpi.c Wed Aug 11 23:21:25 2010 (r211196) @@ -68,6 +68,7 @@ static void acpi_print_srat_cpu(uint32_t static voidacpi_print_srat_memory(ACPI_SRAT_MEM_AFFINITY *mp); static voidacpi_print_srat(ACPI_SUBTABLE_HEADER *srat); static voidacpi_handle_srat(ACPI_TABLE_HEADER *sdp); +static voidacpi_handle_tcpa(ACPI_TABLE_HEADER *sdp); static voidacpi_print_sdt(ACPI_TABLE_HEADER *sdp); static voidacpi_print_fadt(ACPI_TABLE_HEADER *sdp); static voidacpi_print_facs(ACPI_TABLE_FACS *facs); @@ -81,6 +82,46 @@ static void acpi_walk_subtables(ACPI_TAB /* Size of an address. 32-bit for ACPI 1.0, 64-bit for ACPI 2.0 and up. */ static int addr_size; +/* Strings used in the TCPA table */ +static const char *tcpa_event_type_strings[] = { + "PREBOOT Certificate", + "POST Code", + "Unused", + "No Action", + "Separator", + "Action", + "Event Tag", + "S-CRTM Contents", + "S-CRTM Version", + "CPU Microcode", + "Platform Config Flags", + "Table of Devices", + "Compact Hash", + "IPL", + "IPL Partition Data", + "Non-Host Code", + "Non-Host Config", + "Non-Host Info" +}; + +static const char *TCPA_pcclient_strings[] = { + "", + "SMBIOS", + "BIS Certificate", + "POST BIOS ROM Strings", + "ESCD", + "CMOS", + "NVRAM", + "Option ROM Execute", + "Option ROM Configurateion", + "", + "Option ROM Microcode Update ", + "S-CRTM Version String", + "S-CRTM Contents", + "POST Contents", + "Table of Devices", +}; + static void acpi_print_string(char *s, size_t length) { @@ -492,6 +533,165 @@ acpi_print_srat_cpu(uint32_t apic_id, ui printf("\tProximity Domain=%d\n", proximity_domain); } +static char * +acpi_tcpa_evname(struct TCPAevent *event) +{ + struct TCPApc_event *pc_event; + char *eventname = NULL; + + pc_event = (struct TCPApc_event *)(event + 1); + + switch(event->event_type) { + case PREBOOT: + case POST_CODE: + case UNUSED: + case NO_ACTION: + case SEPARATOR: + case SCRTM_CONTENTS: + case SCRTM_VERSION: + case CPU_MICROCODE: + case PLATFORM_CONFIG_FLAGS: + case TABLE_OF_DEVICES: + case COMPACT_HASH: + case IPL: + case IPL_PARTITION_DATA: + case NONHOST_CODE: + case NONHOST_CONFIG: + case NONHOST_INFO: + asprintf(&eventname, "%s", + tcpa_event_type_strings[event->event_type]); + break; + + case ACTION: + eventname = calloc(event->event_size + 1, sizeof(char)); + memcpy(eventname, pc_event, event->event_size); + break; + + case EVENT_TAG: + switch (pc_event->event_id) { + case SMBIOS: + case BIS_CERT: + case CMOS: + case NVRAM: + case OPTION_ROM_EXEC: + case OPTION_ROM_CONFIG: + case S_CRTM_VERSION: + case POST_BIOS_ROM: + case ESCD: + case OPTION_ROM_MICROCODE: + case S_CRTM_CONTENTS: + case POST_CONTENTS: + asprintf(&eventname, "%s", + TCPA_pcclient_strings[pc_event->event_id]); + break; + + default: + asprintf(&eventname, "", + pc_event->event_id); + break; + } + break; + + default: + asprintf(&eventname, "", event->event_type); + break; + } + + return eventname; +} + +static void +acpi_print_tcpa(struct TCPAevent *event) +{ + int i; + char *eventname; + + eventname = acpi_tcpa_evname(event); + + printf("\t%d", event->pcr_index); + printf(" 0x"); + for (i = 0; i < 20; i++) + printf("%02x", event->pcr_value[i]); + printf(" [%s]\n", eventname ? eventname : ""); + + free(eventname); +} + +static void +acpi_handle_tcpa(ACPI_TABLE_HEADER *sdp) +{ + struct TCPAbody *tcpa; + struct TCPAevent *event; + u_int64_t len, paddr; + unsigned char *vaddr = NULL; + unsigned char *vend = NULL; + + printf(BEGIN_COMMENT); + acpi_print_sdt(sdp); +
svn commit: r209968 - head/sys/dev/usb/serial
Author: takawata Date: Tue Jul 13 03:56:29 2010 New Revision: 209968 URL: http://svn.freebsd.org/changeset/base/209968 Log: Fix comment. Pointed out by: hrs Modified: head/sys/dev/usb/serial/uplcom.c Modified: head/sys/dev/usb/serial/uplcom.c == --- head/sys/dev/usb/serial/uplcom.cTue Jul 13 03:49:30 2010 (r209967) +++ head/sys/dev/usb/serial/uplcom.cTue Jul 13 03:56:29 2010 (r209968) @@ -256,7 +256,7 @@ static const struct usb_device_id uplcom UPLCOM_DEV(PROLIFIC, RSAQ2, 0, 0x, PL2303), /* I/O DATA USB-RSAQ3 */ UPLCOM_DEV(PROLIFIC, RSAQ3, 0, 0x, PL2303X), - /* I/O DATA USB-RSAQ3 */ + /* I/O DATA USB-RSAQ5 */ UPLCOM_DEV(IODATA, USBRSAQ5, 0, 0x, PL2303X), /* PLANEX USB-RS232 URS-03 */ UPLCOM_DEV(ATEN, UC232A, 0, 0x, PL2303), ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r209967 - in head/sys/dev/usb: . serial
Author: takawata Date: Tue Jul 13 03:49:30 2010 New Revision: 209967 URL: http://svn.freebsd.org/changeset/base/209967 Log: One more Prolific serial device ID. Submitted by: Kouichi Hirabayashi on FreeBSD-users-jp MFC after: 1 week. Modified: head/sys/dev/usb/serial/uplcom.c head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/serial/uplcom.c == --- head/sys/dev/usb/serial/uplcom.cTue Jul 13 02:48:42 2010 (r209966) +++ head/sys/dev/usb/serial/uplcom.cTue Jul 13 03:49:30 2010 (r209967) @@ -256,6 +256,8 @@ static const struct usb_device_id uplcom UPLCOM_DEV(PROLIFIC, RSAQ2, 0, 0x, PL2303), /* I/O DATA USB-RSAQ3 */ UPLCOM_DEV(PROLIFIC, RSAQ3, 0, 0x, PL2303X), + /* I/O DATA USB-RSAQ3 */ + UPLCOM_DEV(IODATA, USBRSAQ5, 0, 0x, PL2303X), /* PLANEX USB-RS232 URS-03 */ UPLCOM_DEV(ATEN, UC232A, 0, 0x, PL2303), /* TrendNet TU-S9 */ Modified: head/sys/dev/usb/usbdevs == --- head/sys/dev/usb/usbdevsTue Jul 13 02:48:42 2010(r209966) +++ head/sys/dev/usb/usbdevsTue Jul 13 03:49:30 2010(r209967) @@ -1807,6 +1807,7 @@ product IODATA RT3072_2 0x0945 RT3072 product IODATA RT3072_30x0947 RT3072 product IODATA RT3072_40x0948 RT3072 product IODATA USBRSAQ 0x0a03 Serial USB-RSAQ1 +product IODATA USBRSAQ50x0a0e Serial USB-RSAQ5 product IODATA2 USB2SC 0x0a09 USB2.0-SCSI Bridge USB2-SC /* Iomega products */ ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r200359 - head/sys/dev/ata
Author: takawata Date: Thu Dec 10 16:55:16 2009 New Revision: 200359 URL: http://svn.freebsd.org/changeset/base/200359 Log: Add module dependency for cam if configured as ATA_CAM. Modified: head/sys/dev/ata/ata-all.c Modified: head/sys/dev/ata/ata-all.c == --- head/sys/dev/ata/ata-all.c Thu Dec 10 15:17:34 2009(r200358) +++ head/sys/dev/ata/ata-all.c Thu Dec 10 16:55:16 2009(r200359) @@ -1681,6 +1681,9 @@ ata_module_event_handler(module_t mod, i static moduledata_t ata_moduledata = { "ata", ata_module_event_handler, NULL }; DECLARE_MODULE(ata, ata_moduledata, SI_SUB_CONFIGURE, SI_ORDER_SECOND); MODULE_VERSION(ata, 1); +#ifdef ATA_CAM +MODULE_DEPEND(ata, cam, 1, 1, 1); +#endif static void ata_init(void) ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r191346 - in head/sys/dev/usb: . serial
Author: takawata Date: Tue Apr 21 05:06:31 2009 New Revision: 191346 URL: http://svn.freebsd.org/changeset/base/191346 Log: Add another FTDI serial converter. Modified: head/sys/dev/usb/serial/uftdi.c head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/serial/uftdi.c == --- head/sys/dev/usb/serial/uftdi.c Tue Apr 21 00:42:11 2009 (r191345) +++ head/sys/dev/usb/serial/uftdi.c Tue Apr 21 05:06:31 2009 (r191346) @@ -207,6 +207,7 @@ static struct usb2_device_id uftdi_devs[ {USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SERIAL_8U100AX, UFTDI_TYPE_SIO)}, {USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SERIAL_2232C, UFTDI_TYPE_8U232AM)}, {USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SERIAL_8U232AM, UFTDI_TYPE_8U232AM)}, + {USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SERIAL_8U232AM4, UFTDI_TYPE_8U232AM)}, {USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SEMC_DSS20, UFTDI_TYPE_8U232AM)}, {USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_CFA_631, UFTDI_TYPE_8U232AM)}, {USB_VPI(USB_VENDOR_FTDI, USB_PRODUCT_FTDI_CFA_632, UFTDI_TYPE_8U232AM)}, Modified: head/sys/dev/usb/usbdevs == --- head/sys/dev/usb/usbdevsTue Apr 21 00:42:11 2009(r191345) +++ head/sys/dev/usb/usbdevsTue Apr 21 05:06:31 2009(r191346) @@ -1287,6 +1287,7 @@ product FSC E5400 0x1009 PrismGT USB 2. /* Future Technology Devices products */ product FTDI SERIAL_8U100AX0x8372 8U100AX Serial product FTDI SERIAL_8U232AM0x6001 8U232AM Serial +product FTDI SERIAL_8U232AM4 0x6004 8U232AM Serial product FTDI SERIAL_2232C 0x6010 FT2232C Dual port Serial /* Gude Analog- und Digitalsysteme products also uses FTDI's id: */ product FTDI TACTRIX_OPENPORT_13M 0xcc48 OpenPort 1.3 Mitsubishi ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r187579 - head/sys/dev/usb2/serial
Author: takawata Date: Thu Jan 22 05:05:56 2009 New Revision: 187579 URL: http://svn.freebsd.org/changeset/base/187579 Log: Rename sc_is_pseudo to sc_nobulk member in ufoma_softc. That was pseudo ucom because it used home brew tty interface. Now, it is integrated to usb serial framework, so it is not pseudo ucom any more. Modified: head/sys/dev/usb2/serial/ufoma2.c Modified: head/sys/dev/usb2/serial/ufoma2.c == --- head/sys/dev/usb2/serial/ufoma2.c Thu Jan 22 04:24:15 2009 (r187578) +++ head/sys/dev/usb2/serial/ufoma2.c Thu Jan 22 05:05:56 2009 (r187579) @@ -175,7 +175,7 @@ struct ufoma_softc { uint16_t sc_line; uint8_t sc_num_msg; - uint8_t sc_is_pseudo; + uint8_t sc_nobulk; uint8_t sc_ctrl_iface_no; uint8_t sc_ctrl_iface_index; uint8_t sc_data_iface_no; @@ -449,9 +449,9 @@ ufoma_attach(device_t dev) } if ((mad->bType == UMCPC_ACM_TYPE_AB5) || (mad->bType == UMCPC_ACM_TYPE_AB6)) { - sc->sc_is_pseudo = 1; + sc->sc_nobulk = 1; } else { - sc->sc_is_pseudo = 0; + sc->sc_nobulk = 0; if (ufoma_modem_setup(dev, sc, uaa)) { goto detach; } @@ -764,7 +764,7 @@ ufoma_intr_callback(struct usb2_xfer *xf } switch (pkt.bNotification) { case UCDC_N_RESPONSE_AVAILABLE: - if (!(sc->sc_is_pseudo)) { + if (!(sc->sc_nobulk)) { DPRINTF("Wrong serial state!\n"); break; } @@ -775,7 +775,7 @@ ufoma_intr_callback(struct usb2_xfer *xf break; case UCDC_N_SERIAL_STATE: - if (sc->sc_is_pseudo) { + if (sc->sc_nobulk) { DPRINTF("Wrong serial state!\n"); break; } @@ -952,7 +952,7 @@ ufoma_cfg_set_break(struct usb2_com_soft struct usb2_device_request req; uint16_t wValue; - if (sc->sc_is_pseudo || + if (sc->sc_nobulk || (sc->sc_currentmode == UMCPC_ACM_MODE_OBEX)) { return; } @@ -1004,7 +1004,7 @@ ufoma_cfg_set_dtr(struct usb2_com_softc { struct ufoma_softc *sc = ucom->sc_parent; - if (sc->sc_is_pseudo) { + if (sc->sc_nobulk) { return; } if (onoff) @@ -1020,7 +1020,7 @@ ufoma_cfg_set_rts(struct usb2_com_softc { struct ufoma_softc *sc = ucom->sc_parent; - if (sc->sc_is_pseudo) { + if (sc->sc_nobulk) { return; } if (onoff) @@ -1044,7 +1044,7 @@ ufoma_cfg_param(struct usb2_com_softc *u struct usb2_device_request req; struct usb2_cdc_line_state ls; - if (sc->sc_is_pseudo || + if (sc->sc_nobulk || (sc->sc_currentmode == UMCPC_ACM_MODE_OBEX)) { return; } @@ -1175,7 +1175,7 @@ ufoma_start_read(struct usb2_com_softc * usb2_transfer_start(sc->sc_ctrl_xfer[UFOMA_CTRL_ENDPT_INTR]); /* start data transfer */ - if (sc->sc_is_pseudo) { + if (sc->sc_nobulk) { usb2_transfer_start(sc->sc_ctrl_xfer[UFOMA_CTRL_ENDPT_READ]); } else { usb2_transfer_start(sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_READ]); @@ -1192,7 +1192,7 @@ ufoma_stop_read(struct usb2_com_softc *u usb2_transfer_stop(sc->sc_ctrl_xfer[UFOMA_CTRL_ENDPT_INTR_CLEAR]); /* stop data transfer */ - if (sc->sc_is_pseudo) { + if (sc->sc_nobulk) { usb2_transfer_stop(sc->sc_ctrl_xfer[UFOMA_CTRL_ENDPT_READ]); } else { usb2_transfer_stop(sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_READ_CLEAR]); @@ -1205,7 +1205,7 @@ ufoma_start_write(struct usb2_com_softc { struct ufoma_softc *sc = ucom->sc_parent; - if (sc->sc_is_pseudo) { + if (sc->sc_nobulk) { usb2_transfer_start(sc->sc_ctrl_xfer[UFOMA_CTRL_ENDPT_WRITE]); } else { usb2_transfer_start(sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_WRITE]); @@ -1217,7 +1217,7 @@ ufoma_stop_write(struct usb2_com_softc * { struct ufoma_softc *sc = ucom->sc_parent; - if (sc->sc_is_pseudo) { + if (sc->sc_nobulk) { usb2_transfer_stop(sc->sc_ctrl_xfer[UFOMA_CTRL_ENDPT_WRITE]); } else { usb2_transfer_stop(sc->sc_bulk_xfer[UFOMA_BULK_ENDPT_WRITE_CLEAR]); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r187299 - head/sys/dev/usb2/serial
Author: takawata Date: Thu Jan 15 16:04:11 2009 New Revision: 187299 URL: http://svn.freebsd.org/changeset/base/187299 Log: Name the items of xfer array. Modified: head/sys/dev/usb2/serial/ufoma2.c Modified: head/sys/dev/usb2/serial/ufoma2.c == --- head/sys/dev/usb2/serial/ufoma2.c Thu Jan 15 12:15:46 2009 (r187298) +++ head/sys/dev/usb2/serial/ufoma2.c Thu Jan 15 16:04:11 2009 (r187299) @@ -143,8 +143,21 @@ typedef struct ufoma_mobile_acm_descript #defineUFOMA_BULK_BUF_SIZE 1024/* bytes */ -#defineUFOMA_CTRL_ENDPT_MAX 4 /* units */ -#defineUFOMA_BULK_ENDPT_MAX 4 /* units */ +enum { + UFOMA_CTRL_ENDPT_INTR, + UFOMA_CTRL_ENDPT_INTR_CLEAR, + UFOMA_CTRL_ENDPT_READ, + UFOMA_CTRL_ENDPT_WRITE, + UFOMA_CTRL_ENDPT_MAX = 4, +}; + +enum { + UFOMA_BULK_ENDPT_WRITE, + UFOMA_BULK_ENDPT_READ, + UFOMA_BULK_ENDPT_WRITE_CLEAR, + UFOMA_BULK_ENDPT_READ_CLEAR, + UFOMA_BULK_ENDPT_MAX = 4, +}; struct ufoma_softc { struct usb2_com_super_softc sc_super_ucom; @@ -227,7 +240,7 @@ static int ufoma_sysctl_open(SYSCTL_HAND static const struct usb2_config ufoma_ctrl_config[UFOMA_CTRL_ENDPT_MAX] = { - [0] = { + [UFOMA_CTRL_ENDPT_INTR] = { .type = UE_INTERRUPT, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, @@ -236,7 +249,7 @@ static const struct usb2_config .mh.callback = &ufoma_intr_callback, }, - [1] = { + [UFOMA_CTRL_ENDPT_INTR_CLEAR] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, @@ -247,7 +260,7 @@ static const struct usb2_config .mh.interval = 50, /* 50ms */ }, - [2] = { + [UFOMA_CTRL_ENDPT_READ] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, @@ -257,7 +270,7 @@ static const struct usb2_config .mh.timeout = 1000, /* 1 second */ }, - [3] = { + [UFOMA_CTRL_ENDPT_WRITE] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, @@ -271,7 +284,7 @@ static const struct usb2_config static const struct usb2_config ufoma_bulk_config[UFOMA_BULK_ENDPT_MAX] = { - [0] = { + [UFOMA_BULK_ENDPT_WRITE] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, @@ -280,7 +293,7 @@ static const struct usb2_config .mh.callback = &ufoma_bulk_write_callback, }, - [1] = { + [UFOMA_BULK_ENDPT_READ] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, @@ -289,7 +302,7 @@ static const struct usb2_config .mh.callback = &ufoma_bulk_read_callback, }, - [2] = { + [UFOMA_BULK_ENDPT_WRITE_CLEAR] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, @@ -300,7 +313,7 @@ static const struct usb2_config .mh.interval = 50, /* 50ms */ }, - [3] = { + [UFOMA_BULK_ENDPT_READ_CLEAR] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ .direction = UE_DIR_ANY, @@ -701,7 +714,7 @@ static void ufoma_intr_clear_stall_callback(struct usb2_xfer *xfer) { struct ufoma_softc *sc = xfer->priv_sc; - struct usb2_xfer *xfer_other = sc->sc_ctrl_xfer[0]; + struct usb2_xfer *xfer_other = sc->sc_ctrl_xfer[UFOMA_CTRL_ENDPT_INTR]; if (usb2_clear_stall_callback(xfer, xfer_other)) { DPRINTF("stall cleared\n"); @@ -758,7 +771,7 @@ ufoma_intr_callback(struct usb2_xfer *xf if (sc->sc_num_msg != 0xFF) { sc->sc_num_msg++; } - usb2_transfer_start(sc->sc_ctrl_xfer[2]); + usb2_transfer_start(sc->sc_ctrl_xfer[UFOMA_CTRL_ENDPT_READ]); break; case UCDC_N_SERIAL_STATE: @@ -803,7 +816,7 @@ ufoma_intr_callback(struct usb2_xfer *xf case USB_ST_SETUP: tr_setup: if (sc->sc_flags & UFOMA_FLAG_INTR_STALL) { - usb2_transfer_start(sc->sc_ctrl_xfer[1]); + usb2_transfer_start(sc->sc_ctrl_xfer[UFOMA_CTRL_ENDPT_INTR_CLEAR]); } else { xfer->frlengths[0] = xfer->max_data_length; usb2_start_hardware(xfer); @@ -814,7 +827,7 @@ tr_setup: if (xfer->error != USB_ERR_CANCELL
svn commit: r187113 - head/sys/dev/usb2/serial
Author: takawata Date: Mon Jan 12 20:13:14 2009 New Revision: 187113 URL: http://svn.freebsd.org/changeset/base/187113 Log: More usb2 foma driver update. 1. Export usb serial port unit number as sysctl. 2. Fix bug on handsfree port. Modified: head/sys/dev/usb2/serial/ufoma2.c Modified: head/sys/dev/usb2/serial/ufoma2.c == --- head/sys/dev/usb2/serial/ufoma2.c Mon Jan 12 19:23:46 2009 (r187112) +++ head/sys/dev/usb2/serial/ufoma2.c Mon Jan 12 20:13:14 2009 (r187113) @@ -3,7 +3,6 @@ #include __FBSDID("$FreeBSD$"); #define UFOMA_HANDSFREE - /*- * Copyright (c) 2005, Takanori Watanabe * Copyright (c) 2003, M. Warner Losh . @@ -486,7 +485,9 @@ ufoma_attach(device_t dev) SYSCTL_ADD_PROC(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "openmode", CTLFLAG_RW|CTLTYPE_STRING, sc, 0, ufoma_sysctl_open, "A", "Mode to transit when port is opened"); - + SYSCTL_ADD_UINT(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "comunit", + CTLFLAG_RD, &(sc->sc_ucom.sc_unit), 0, + "Unit number as USB serial"); return (0); /* success */ @@ -758,7 +759,7 @@ ufoma_intr_callback(struct usb2_xfer *xf if (sc->sc_num_msg != 0xFF) { sc->sc_num_msg++; } - usb2_transfer_start(sc->sc_ctrl_xfer[3]); + usb2_transfer_start(sc->sc_ctrl_xfer[2]); break; case UCDC_N_SERIAL_STATE: ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r186885 - head/sys/dev/usb2/serial
Author: takawata Date: Thu Jan 8 05:10:03 2009 New Revision: 186885 URL: http://svn.freebsd.org/changeset/base/186885 Log: Make ufoma2 driver work. 1.Sync TD on close to ensure USB request in close callback issued. 2.Add sysctls to indicate device role. 3.Enable handsfree port support. Now modem port and obex port works well. Handsfree port works but not with good response. Modified: head/sys/dev/usb2/serial/ufoma2.c head/sys/dev/usb2/serial/usb2_serial.c Modified: head/sys/dev/usb2/serial/ufoma2.c == --- head/sys/dev/usb2/serial/ufoma2.c Thu Jan 8 04:26:44 2009 (r186884) +++ head/sys/dev/usb2/serial/ufoma2.c Thu Jan 8 05:10:03 2009 (r186885) @@ -2,6 +2,7 @@ #include __FBSDID("$FreeBSD$"); +#define UFOMA_HANDSFREE /*- * Copyright (c) 2005, Takanori Watanabe @@ -101,6 +102,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include typedef struct ufoma_mobile_acm_descriptor { uint8_t bFunctionLength; @@ -217,6 +220,12 @@ static voidufoma_stop_read(struct usb2_ static voidufoma_start_write(struct usb2_com_softc *); static voidufoma_stop_write(struct usb2_com_softc *); +/*sysctl stuff*/ +static int ufoma_sysctl_support(SYSCTL_HANDLER_ARGS); +static int ufoma_sysctl_current(SYSCTL_HANDLER_ARGS); +static int ufoma_sysctl_open(SYSCTL_HANDLER_ARGS); + + static const struct usb2_config ufoma_ctrl_config[UFOMA_CTRL_ENDPT_MAX] = { @@ -380,6 +389,9 @@ ufoma_attach(device_t dev) struct ufoma_softc *sc = device_get_softc(dev); struct usb2_config_descriptor *cd; struct usb2_interface_descriptor *id; + struct sysctl_ctx_list *sctx; + struct sysctl_oid *soid; + usb2_mcpc_acm_descriptor *mad; uint8_t elements; int32_t error; @@ -459,6 +471,23 @@ ufoma_attach(device_t dev) DPRINTF("usb2_com_attach failed\n"); goto detach; } + /*Sysctls*/ + sctx = device_get_sysctl_ctx(dev); + soid = device_get_sysctl_tree(dev); + + SYSCTL_ADD_PROC(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "supportmode", + CTLFLAG_RD|CTLTYPE_STRING, sc, 0, ufoma_sysctl_support, + "A", "Supporting port role"); + + SYSCTL_ADD_PROC(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "currentmode", + CTLFLAG_RD|CTLTYPE_STRING, sc, 0, ufoma_sysctl_current, + "A", "Current port role"); + + SYSCTL_ADD_PROC(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "openmode", + CTLFLAG_RW|CTLTYPE_STRING, sc, 0, ufoma_sysctl_open, + "A", "Mode to transit when port is opened"); + + return (0); /* success */ detach: @@ -910,7 +939,8 @@ ufoma_cfg_set_break(struct usb2_com_soft struct usb2_device_request req; uint16_t wValue; - if (sc->sc_is_pseudo) { + if (sc->sc_is_pseudo || + (sc->sc_currentmode == UMCPC_ACM_MODE_OBEX)) { return; } if (!(sc->sc_acm_cap & USB_CDC_ACM_HAS_BREAK)) { @@ -1181,3 +1211,113 @@ ufoma_stop_write(struct usb2_com_softc * usb2_transfer_stop(sc->sc_bulk_xfer[0]); } } + +struct umcpc_modetostr_tab{ + int mode; + char *str; +}umcpc_modetostr_tab[]={ + {UMCPC_ACM_MODE_DEACTIVATED, "deactivated"}, + {UMCPC_ACM_MODE_MODEM, "modem"}, + {UMCPC_ACM_MODE_ATCOMMAND, "handsfree"}, + {UMCPC_ACM_MODE_OBEX, "obex"}, + {UMCPC_ACM_MODE_VENDOR1, "vendor1"}, + {UMCPC_ACM_MODE_VENDOR2, "vendor2"}, + {UMCPC_ACM_MODE_UNLINKED, "unlinked"}, + {0, NULL} +}; + +static char *ufoma_mode_to_str(int mode) +{ + int i; + for(i = 0 ;umcpc_modetostr_tab[i].str != NULL; i++){ + if(umcpc_modetostr_tab[i].mode == mode){ + return umcpc_modetostr_tab[i].str; + } + } + return NULL; +} + +static int ufoma_str_to_mode(char *str) +{ + int i; + for(i = 0 ;umcpc_modetostr_tab[i].str != NULL; i++){ + if(strcmp(str, umcpc_modetostr_tab[i].str)==0){ + return umcpc_modetostr_tab[i].mode; + } + } + return -1; +} + +static int ufoma_sysctl_support(SYSCTL_HANDLER_ARGS) +{ + struct ufoma_softc *sc = (struct ufoma_softc *)oidp->oid_arg1; + struct sbuf sb; + int i; + char *mode; + + sbuf_new(&sb, NULL, 1, SBUF_AUTOEXTEND); + for(i = 1; i < sc->sc_modetable[0]; i++){ + mode = ufoma_mode_to_str(sc->sc_modetable[i]); + if(mode !=NULL){ +
svn commit: r185295 - head/sys/i386/i386
Author: takawata Date: Tue Nov 25 13:35:06 2008 New Revision: 185295 URL: http://svn.freebsd.org/changeset/base/185295 Log: Core i7 supports invaliant TSC and the presense is presented on this CPUID information, according to recently updated AP485. Modified: head/sys/i386/i386/identcpu.c Modified: head/sys/i386/i386/identcpu.c == --- head/sys/i386/i386/identcpu.c Tue Nov 25 13:33:18 2008 (r185294) +++ head/sys/i386/i386/identcpu.c Tue Nov 25 13:35:06 2008 (r185295) @@ -846,7 +846,8 @@ printcpuinfo(void) * mention the capability. */ if (!tsc_is_invariant && - (strcmp(cpu_vendor, "AuthenticAMD") == 0 && + ((strcmp(cpu_vendor, "AuthenticAMD") == 0 || + (strcmp(cpu_vendor, "GenuineIntel") == 0))&& ((amd_pminfo & AMDPM_TSC_INVARIANT) != 0 || I386_CPU_FAMILY(cpu_id) >= 0x10 || cpu_id == 0x60fb2))) { ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "[EMAIL PROTECTED]"