* [U-Boot] [PATCH v3] arm926ejs: add NXP LPC32x0 cpu series support
From: Albert ARIBAUD @ 2011-10-21 23:31 UTC (permalink / raw)
To: u-boot
In-Reply-To: <1318953340-30248-1-git-send-email-vz@mleia.com>
Hi Vladimir,
Le 18/10/2011 17:55, Vladimir Zapolskiy a ?crit :
> This change adds initial support for NXP LPC32x0 SoC series.
>
> Signed-off-by: Vladimir Zapolskiy<vz@mleia.com>
> ---
> Changes from v2 to v3:
> * checkpatch.pl reports zero errors and warnings
>
> Changes from v1 to v2:
> * BIT(n) and SBF(s, v) macro are not used anymore
> * removed NS16550 and 14-clock UART definitions from uart.h
> * added devices.c file, which contains standard UART preinitialization routine
> * added get_serial_clock() function, it returns actual frequency of UART clock
> * __udelay() realization is simplified, no need of interrupt handling
As it stands, this is dead code until some board uses it; I imagine you
have board waiting for this support. Can you submit the SoC and board
code as a patch set? This way, it will be obvious for all that the SoC
code in this patch has actual use.
Amicalement,
--
Albert.
^ permalink raw reply
* [PATCH 4/4] Minor cleanup of indentation in output
From: Peter Krystad @ 2011-10-21 23:30 UTC (permalink / raw)
To: linux-bluetooth; +Cc: andrei.emeltchenko, Peter Krystad
In-Reply-To: <1319239802-22457-1-git-send-email-pkrystad@codeaurora.org>
Minor indentation cleanup and fix display of physical link key
---
parser/hci.c | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/parser/hci.c b/parser/hci.c
index a0e3034..e459e9e 100644
--- a/parser/hci.c
+++ b/parser/hci.c
@@ -1124,12 +1124,11 @@ static inline void create_physical_link_dump(int level, struct frame *frm)
int i;
p_indent(level, frm);
-
printf("handle %d key length %d key type %d\n",
cp->handle, cp->key_length, cp->key_type);
+ p_indent(level, frm);
printf("key ");
-
- for (i = 0; i < cp->key_length && cp->key_length < 32; i++)
+ for (i = 0; i < cp->key_length && cp->key_length <= 32; i++)
printf("%2.2x", cp->key[i]);
printf("\n");
}
@@ -1140,12 +1139,16 @@ static inline void create_logical_link_dump(int level, struct frame *frm)
int i;
p_indent(level, frm);
-
printf("handle %d\n", cp->handle);
+
+ p_indent(level, frm);
printf("tx_flow ");
for (i = 0; i < 16; i++)
printf("%2.2x", cp->tx_flow[i]);
- printf("\nrx_flow ");
+ printf("\n");
+
+ p_indent(level, frm);
+ printf("rx_flow ");
for (i = 0; i < 16; i++)
printf("%2.2x", cp->rx_flow[i]);
printf("\n");
@@ -2605,6 +2608,8 @@ static inline void read_local_amp_assoc_dump(int level, struct frame *frm)
p_indent(level, frm);
printf("Error: %s\n", status2str(rp->status));
} else {
+ p_indent(level, frm);
+ printf("assoc data");
for (i = 0; i < len; i++) {
if (!(i % 16)) {
printf("\n");
--
1.7.7
--
Peter Krystad
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum
^ permalink raw reply related
* [PATCH 3/4] Add parsing of L2CAP Fixed Channel list
From: Peter Krystad @ 2011-10-21 23:30 UTC (permalink / raw)
To: linux-bluetooth; +Cc: andrei.emeltchenko, Peter Krystad
In-Reply-To: <1319239802-22457-1-git-send-email-pkrystad@codeaurora.org>
Add DUMP_VERBOSE display of L2CAP Fixed Channel list.
Example output:
2011-10-21 12:01:50.423246 > ACL data: handle 39 flags 0x02 dlen 20
L2CAP(s): Info rsp: type 3 result 0
Fixed channel list
L2CAP
CONNLESS
A2MP
---
parser/l2cap.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/parser/l2cap.c b/parser/l2cap.c
index 7915788..ce78d05 100644
--- a/parser/l2cap.c
+++ b/parser/l2cap.c
@@ -811,6 +811,7 @@ static void info_opt(int level, int type, void *ptr, int len)
{
uint32_t mask;
int i;
+ uint8_t list;
p_indent(level, 0);
@@ -830,6 +831,21 @@ static void info_opt(int level, int type, void *ptr, int len)
break;
case 0x0003:
printf("Fixed channel list\n");
+ list = get_val(ptr, 1);
+ if (parser.flags & DUMP_VERBOSE) {
+ if (list & L2CAP_FC_L2CAP) {
+ p_indent(level + 1, 0);
+ printf("L2CAP\n");
+ }
+ if (list & L2CAP_FC_CONNLESS) {
+ p_indent(level + 1, 0);
+ printf("CONNLESS\n");
+ }
+ if (list & L2CAP_FC_A2MP) {
+ p_indent(level + 1, 0);
+ printf("A2MP\n");
+ }
+ }
break;
default:
printf("Unknown (len %d)\n", len);
--
1.7.7
--
Peter Krystad
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum
^ permalink raw reply related
* [PATCH 2/4] Add parsing of A2MP signals
From: Peter Krystad @ 2011-10-21 23:30 UTC (permalink / raw)
To: linux-bluetooth; +Cc: andrei.emeltchenko, Peter Krystad
In-Reply-To: <1319239802-22457-1-git-send-email-pkrystad@codeaurora.org>
Add parsing of A2MP signalling.
Example output:
2011-10-18 16:09:44.493202 > ACL data: handle 39 flags 0x02 dlen 16
A2MP: Discover req: mtu/mps 670 mask: 0x0000
2011-10-18 16:09:44.493404 < ACL data: handle 39 flags 0x00 dlen 22
A2MP: Discover rsp: mtu/mps 670 mask: 0x0000
Controller list:
id 0, type 0, status 0x01 (Bluetooth only)
id 17, type 254, status 0x06 (Full capacity)
2011-10-18 16:09:44.697203 > ACL data: handle 39 flags 0x02 dlen 13
A2MP: Get Info req: id 17
2011-10-18 16:09:44.697312 < ACL data: handle 39 flags 0x00 dlen 30
A2MP: Get Info rsp: id 17 status (0) Success
total bandwidth 500000
max guaranteed bandwidth 0
min latency 100000
pal capabilities 0x0000
assoc size 8
2011-10-18 16:09:44.893203 > ACL data: handle 39 flags 0x02 dlen 13
A2MP: Get AMP Assoc req: id 17
2011-10-18 16:09:44.893618 < ACL data: handle 39 flags 0x00 dlen 22
A2MP: Get AMP Assoc rsp: id 17 status (0) Success
assoc data:
08 01 b1 01 0a 04 6c 42
2011-10-18 16:09:45.598201 > ACL data: handle 39 flags 0x02 dlen 22
A2MP: Create Physical Link req: local id 1 remote id 17
assoc data:
08 01 b1 01 0a 04 6d 38
2011-10-18 16:09:45.598643 < ACL data: handle 39 flags 0x00 dlen 15
A2MP: Create Physical Link rsp: local id 17 remote id 1 status 0
Success
---
lib/amp.h | 133 +++++++++++++++++++
parser/l2cap.c | 385 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
parser/parser.h | 1 +
src/hcidump.c | 1 +
4 files changed, 520 insertions(+), 0 deletions(-)
create mode 100644 lib/amp.h
diff --git a/lib/amp.h b/lib/amp.h
new file mode 100644
index 0000000..0c6300a
--- /dev/null
+++ b/lib/amp.h
@@ -0,0 +1,133 @@
+/*
+ *
+ * BlueZ - Bluetooth protocol stack for Linux
+ *
+ * Copyright (C) 2010-2011 Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __AMP_H
+#define __AMP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define AMP_MGR_CID 0x03
+
+/* AMP manager codes */
+#define AMP_COMMAND_REJ 0x01
+#define AMP_DISCOVER_REQ 0x02
+#define AMP_DISCOVER_RSP 0x03
+#define AMP_CHANGE_NOTIFY 0x04
+#define AMP_CHANGE_RSP 0x05
+#define AMP_INFO_REQ 0x06
+#define AMP_INFO_RSP 0x07
+#define AMP_ASSOC_REQ 0x08
+#define AMP_ASSOC_RSP 0x09
+#define AMP_LINK_REQ 0x0a
+#define AMP_LINK_RSP 0x0b
+#define AMP_DISCONN_REQ 0x0c
+#define AMP_DISCONN_RSP 0x0d
+
+typedef struct {
+ uint8_t code;
+ uint8_t ident;
+ uint16_t len;
+} __attribute__ ((packed)) amp_mgr_hdr;
+#define AMP_MGR_HDR_SIZE 4
+
+/* AMP ASSOC structure */
+typedef struct {
+ uint8_t type_id;
+ uint16_t len;
+ uint8_t data[0];
+} __attribute__ ((packed)) amp_assoc_tlv;
+
+typedef struct {
+ uint16_t reason;
+} __attribute__ ((packed)) amp_cmd_rej_parms;
+
+typedef struct {
+ uint16_t mtu;
+ uint16_t mask;
+} __attribute__ ((packed)) amp_discover_req_parms;
+
+typedef struct {
+ uint16_t mtu;
+ uint16_t mask;
+ uint8_t controller_list[0];
+} __attribute__ ((packed)) amp_discover_rsp_parms;
+
+typedef struct {
+ uint8_t id;
+} __attribute__ ((packed)) amp_info_req_parms;
+
+typedef struct {
+ uint8_t id;
+ uint8_t status;
+ uint32_t total_bandwidth;
+ uint32_t max_bandwidth;
+ uint32_t min_latency;
+ uint16_t pal_caps;
+ uint16_t assoc_size;
+} __attribute__ ((packed)) amp_info_rsp_parms;
+
+typedef struct {
+ uint8_t id;
+ uint8_t status;
+ amp_assoc_tlv assoc;
+} __attribute__ ((packed)) amp_assoc_rsp_parms;
+
+typedef struct {
+ uint8_t local_id;
+ uint8_t remote_id;
+ amp_assoc_tlv assoc;
+} __attribute__ ((packed)) amp_link_req_parms;
+
+typedef struct {
+ uint8_t local_id;
+ uint8_t remote_id;
+ uint8_t status;
+} __attribute__ ((packed)) amp_link_rsp_parms;
+
+typedef struct {
+ uint8_t local_id;
+ uint8_t remote_id;
+} __attribute__ ((packed)) amp_disconn_req_parms;
+
+#define AMP_COMMAND_NOT_RECOGNIZED 0x0000
+
+/* AMP controller status */
+#define AMP_CT_POWERED_DOWN 0x00
+#define AMP_CT_BLUETOOTH_ONLY 0x01
+#define AMP_CT_NO_CAPACITY 0x02
+#define AMP_CT_LOW_CAPACITY 0x03
+#define AMP_CT_MEDIUM_CAPACITY 0x04
+#define AMP_CT_HIGH_CAPACITY 0x05
+#define AMP_CT_FULL_CAPACITY 0x06
+
+/* AMP response status */
+#define AMP_STATUS_SUCCESS 0x00
+#define AMP_STATUS_INVALID_CTRL_ID 0x01
+#define AMP_STATUS_UNABLE_START_LINK_CREATION 0x02
+#define AMP_STATUS_NO_PHYSICAL_LINK_EXISTS 0x02
+#define AMP_STATUS_COLLISION_OCCURED 0x03
+#define AMP_STATUS_DISCONN_REQ_RECVD 0x04
+#define AMP_STATUS_PHYS_LINK_EXISTS 0x05
+#define AMP_STATUS_SECURITY_VIOLATION 0x06
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __AMP_H */
diff --git a/parser/l2cap.c b/parser/l2cap.c
index 7547e8b..7915788 100644
--- a/parser/l2cap.c
+++ b/parser/l2cap.c
@@ -36,6 +36,7 @@
#include "parser/sdp.h"
#include "lib/hci.h"
#include "lib/l2cap.h"
+#include "lib/amp.h"
typedef struct {
uint16_t handle;
@@ -259,6 +260,16 @@ static char *reason2str(uint16_t reason)
}
}
+static char *ampreason2str(uint16_t reason)
+{
+ switch (reason) {
+ case AMP_COMMAND_NOT_RECOGNIZED:
+ return "Command not recognized";
+ default:
+ return "Reserved";
+ }
+}
+
static char *connresult2str(uint16_t result)
{
switch (result) {
@@ -399,6 +410,76 @@ static char *supervisory2str(uint8_t supervisory)
}
}
+static char *ampctstatus2str(uint8_t status)
+{
+ switch (status) {
+ case AMP_CT_POWERED_DOWN:
+ return "Powered down";
+ case AMP_CT_BLUETOOTH_ONLY:
+ return "Bluetooth only";
+ case AMP_CT_NO_CAPACITY:
+ return "No capacity";
+ case AMP_CT_LOW_CAPACITY:
+ return "Low capacity";
+ case AMP_CT_MEDIUM_CAPACITY:
+ return "Medium capacity";
+ case AMP_CT_HIGH_CAPACITY:
+ return "High capacity";
+ case AMP_CT_FULL_CAPACITY:
+ return "Full capacity";
+ default:
+ return "Reserved";
+
+ }
+}
+
+static char *ampstatus2str(uint8_t status)
+{
+ switch (status) {
+ case AMP_STATUS_SUCCESS:
+ return "Success";
+ case AMP_STATUS_INVALID_CTRL_ID:
+ return "Invalid Controller ID";
+ default:
+ return "Reserved";
+ }
+}
+
+static char *ampcplstatus2str(uint8_t status)
+{
+ switch (status) {
+ case AMP_STATUS_SUCCESS:
+ return "Success";
+ case AMP_STATUS_INVALID_CTRL_ID:
+ return "Invalid Controller ID";
+ case AMP_STATUS_UNABLE_START_LINK_CREATION:
+ return "Failed - Unable to start link creation";
+ case AMP_STATUS_COLLISION_OCCURED:
+ return "Failed - Collision occured";
+ case AMP_STATUS_DISCONN_REQ_RECVD:
+ return "Failed - Disconnect physical link received";
+ case AMP_STATUS_PHYS_LINK_EXISTS:
+ return "Failed - Physical link already exists";
+ case AMP_STATUS_SECURITY_VIOLATION:
+ return "Failed - Security violation";
+ default:
+ return "Reserved";
+ }
+}
+
+static char *ampdplstatus2str(uint8_t status)
+{
+ switch (status) {
+ case AMP_STATUS_SUCCESS:
+ return "Success";
+ case AMP_STATUS_INVALID_CTRL_ID:
+ return "Invalid Controller ID";
+ case AMP_STATUS_NO_PHYSICAL_LINK_EXISTS:
+ return "Failed - No Physical Link exists";
+ default:
+ return "Reserved";
+ }
+}
static inline void command_rej(int level, struct frame *frm)
{
@@ -923,6 +1004,240 @@ static inline void move_cfm_rsp(int level, l2cap_cmd_hdr *cmd, struct frame *frm
printf("Move cfm rsp: icid 0x%4.4x\n", icid);
}
+static inline void amp_command_rej(int level, struct frame *frm)
+{
+ amp_cmd_rej_parms *h = frm->ptr;
+ uint16_t reason = btohs(h->reason);
+
+ if (p_filter(FILT_A2MP))
+ return;
+
+ printf("Command Reject: reason (%d)- ", reason);
+ p_indent(level + 1, frm);
+ printf("%s\n", ampreason2str(reason));
+}
+
+static inline void amp_discover_req(int level, struct frame *frm, uint16_t len)
+{
+ amp_discover_req_parms *h = frm->ptr;
+ uint16_t mtu = btohs(h->mtu);
+ uint8_t *octet = (uint8_t *)&(h->mask);
+ uint16_t mask;
+ uint8_t extension;
+
+ if (p_filter(FILT_A2MP))
+ return;
+
+ printf("Discover req: mtu/mps %d ", mtu);
+ len -= 2;
+
+ printf("mask:");
+
+ do {
+ len -= 2;
+ mask = btohs(*(uint16_t *)(&octet[0]));
+ printf(" 0x%4.4x", mask);
+
+ extension = octet[1] & 0x80;
+ octet += 2;
+ } while ((extension != 0) && (len >= 2));
+
+ printf("\n");
+}
+
+static inline void controller_list_dump (int level, uint8_t *octet, uint16_t len)
+{
+ if (p_filter(FILT_A2MP))
+ return;
+
+ p_indent(level, 0);
+ printf("Controller list:\n");
+
+ while (len >= 3) {
+ p_indent(level + 1, 0);
+ printf("id %d, type %d, status 0x%2.2x (%s)\n",
+ octet[0], octet[1], octet[2], ampctstatus2str(octet[2]));
+ octet += 3;
+ len -= 3;
+ }
+
+}
+
+static inline void amp_discover_rsp(int level, struct frame *frm, uint16_t len)
+{
+ amp_discover_rsp_parms *h = frm->ptr;
+ uint16_t mtu = btohs(h->mtu);
+ uint8_t *octet = (uint8_t *)&(h->mask);
+ uint16_t mask;
+ uint8_t extension;
+
+ if (p_filter(FILT_A2MP))
+ return;
+
+ printf("Discover rsp: mtu/mps %d ", mtu);
+ len -= 2;
+
+ printf("mask:");
+
+ do {
+ len -= 2;
+ mask = btohs(*(uint16_t *)(&octet[0]));
+ printf(" 0x%4.4x", mask);
+
+ extension = octet[1] & 0x80;
+ octet += 2;
+ } while ((extension != 0) && (len >= 2));
+
+ printf("\n");
+
+ if (len >= 3) {
+ controller_list_dump (level + 1, octet, len);
+ }
+}
+
+static inline void amp_change_notify(int level, struct frame *frm, uint16_t len)
+{
+ uint8_t *octet = frm->ptr;
+
+ if (p_filter(FILT_A2MP))
+ return;
+
+ printf("Change Notify\n");
+
+ if (len >= 3) {
+ controller_list_dump (level + 1, octet, len);
+ }
+}
+
+static inline void amp_change_rsp(int level, struct frame *frm)
+{
+ if (p_filter(FILT_A2MP))
+ return;
+
+ printf("Change Response\n");
+}
+
+static inline void amp_info_req(int level, struct frame *frm)
+{
+ amp_info_req_parms *h = frm->ptr;
+
+ if (p_filter(FILT_A2MP))
+ return;
+
+ printf("Get Info req: id %d\n", h->id);
+}
+
+static inline void amp_info_rsp(int level, struct frame *frm)
+{
+ amp_info_rsp_parms *h = frm->ptr;
+
+ if (p_filter(FILT_A2MP))
+ return;
+
+ printf("Get Info rsp: id %d status (%d) %s\n",
+ h->id, h->status, ampstatus2str(h->status));
+
+ p_indent(level + 1, frm);
+ printf("total bandwidth %d\n", btohl(h->total_bandwidth));
+ p_indent(level + 1, frm);
+ printf("max guaranteed bandwidth %d\n", btohl(h->max_bandwidth));
+ p_indent(level + 1, frm);
+ printf("min latency %d\n", btohl(h->min_latency));
+ p_indent(level + 1, frm);
+ printf("pal capabilities 0x%4.4x\n", btohs(h->pal_caps));
+ p_indent(level + 1, frm);
+ printf("assoc size %d\n", btohs(h->assoc_size));
+}
+
+static inline void amp_assoc_req(int level, struct frame *frm)
+{
+ amp_info_req_parms *h = frm->ptr;
+
+ if (p_filter(FILT_A2MP))
+ return;
+
+ printf("Get AMP Assoc req: id %d\n", h->id);
+}
+
+static inline void amp_assoc_dump(int level, uint8_t *assoc, uint16_t len)
+{
+ int i;
+
+ if (p_filter(FILT_A2MP))
+ return;
+
+ p_indent(level, 0);
+ printf("assoc data:");
+ for (i = 0; i < len; i++) {
+ if (!(i%16)) printf("\n");
+ if (!(i%16)) p_indent(level+1, 0);
+ printf("%2.2x ",*assoc++);
+ }
+ printf("\n");
+
+}
+
+static inline void amp_assoc_rsp(int level, struct frame *frm, uint16_t len)
+{
+ amp_assoc_rsp_parms *h = frm->ptr;
+
+ if (p_filter(FILT_A2MP))
+ return;
+
+ printf("Get AMP Assoc rsp: id %d status (%d) %s \n",
+ h->id, h->status, ampstatus2str(h->status));
+ amp_assoc_dump(level + 1, (uint8_t *) &h->assoc, len - 2);
+}
+
+static inline void amp_link_req(int level, struct frame *frm, uint16_t len)
+{
+ amp_link_req_parms *h = frm->ptr;
+
+ if (p_filter(FILT_A2MP))
+ return;
+
+ printf("Create Physical Link req: local id %d remote id %d\n",
+ h->local_id, h->remote_id);
+ amp_assoc_dump(level + 1, (uint8_t *) &h->assoc, len - 2);
+}
+
+static inline void amp_link_rsp(int level, struct frame *frm)
+{
+ amp_link_rsp_parms *h = frm->ptr;
+
+ if (p_filter(FILT_A2MP))
+ return;
+
+ printf("Create Physical Link rsp: local id %d remote id %d status %d\n",
+ h->local_id, h->remote_id, h->status);
+ p_indent(level+1, 0);
+ printf("%s\n", ampcplstatus2str(h->status));
+}
+
+static inline void amp_disconn_req(int level, struct frame *frm)
+{
+ amp_disconn_req_parms *h = frm->ptr;
+
+ if (p_filter(FILT_A2MP))
+ return;
+
+ printf("Disconnect Physical Link req: local id %d remote id %d\n",
+ h->local_id, h->remote_id);
+}
+
+static inline void amp_disconn_rsp(int level, struct frame *frm)
+{
+ amp_link_rsp_parms *h = frm->ptr;
+
+ if (p_filter(FILT_A2MP))
+ return;
+
+ printf("Disconnect Physical Link rsp: local id %d remote id %d status %d\n",
+ h->local_id, h->remote_id, h->status);
+ p_indent(level+1, 0);
+ printf("%s\n", ampdplstatus2str(h->status));
+}
+
static void l2cap_parse(int level, struct frame *frm)
{
l2cap_hdr *hdr = (void *)frm->ptr;
@@ -1043,6 +1358,76 @@ static void l2cap_parse(int level, struct frame *frm)
p_indent(level, frm);
printf("L2CAP(c): len %d psm %d\n", dlen, psm);
raw_dump(level, frm);
+ } else if ((cid == 0x3) && (frm->len > 4)) {
+
+ /* Adjust for extra ERTM control bytes */
+ frm->ptr += 2;
+ frm->len -= 2;
+
+ while (frm->len >= AMP_MGR_HDR_SIZE) {
+ amp_mgr_hdr *hdr = frm->ptr;
+
+ frm->ptr += AMP_MGR_HDR_SIZE;
+ frm->len -= AMP_MGR_HDR_SIZE;
+
+ if (!p_filter(FILT_A2MP)) {
+ p_indent(level, frm);
+ printf("A2MP: ");
+ }
+ switch (hdr->code) {
+ case AMP_COMMAND_REJ:
+ amp_command_rej(level, frm);
+ break;
+ case AMP_DISCOVER_REQ:
+ amp_discover_req(level, frm, hdr->len);
+ break;
+ case AMP_DISCOVER_RSP:
+ amp_discover_rsp(level, frm, hdr->len);
+ break;
+ case AMP_CHANGE_NOTIFY:
+ amp_change_notify(level, frm, hdr->len);
+ break;
+ case AMP_CHANGE_RSP:
+ amp_change_rsp(level, frm);
+ break;
+ case AMP_INFO_REQ:
+ amp_info_req(level, frm);
+ break;
+ case AMP_INFO_RSP:
+ amp_info_rsp(level, frm);
+ break;
+ case AMP_ASSOC_REQ:
+ amp_assoc_req(level, frm);
+ break;
+ case AMP_ASSOC_RSP:
+ amp_assoc_rsp(level, frm, hdr->len);
+ break;
+ case AMP_LINK_REQ:
+ amp_link_req(level, frm, hdr->len);
+ break;
+ case AMP_LINK_RSP:
+ amp_link_rsp(level, frm);
+ break;
+ case AMP_DISCONN_REQ:
+ amp_disconn_req(level, frm);
+ break;
+ case AMP_DISCONN_RSP:
+ amp_disconn_rsp(level, frm);
+ break;
+ default:
+ if (p_filter(FILT_A2MP))
+ break;
+ printf("code 0x%2.2x ident %d len %d\n",
+ hdr->code, hdr->ident, btohs(hdr->len));
+ raw_dump(level, frm);
+ }
+
+ if (frm->len > btohs(hdr->len)) {
+ frm->len -= btohs(hdr->len);
+ frm->ptr += btohs(hdr->len);
+ } else
+ frm->len = 0;
+ }
} else if (cid == 0x04) {
if (!p_filter(FILT_ATT))
att_dump(level, frm);
diff --git a/parser/parser.h b/parser/parser.h
index e975808..22d18c3 100644
--- a/parser/parser.h
+++ b/parser/parser.h
@@ -80,6 +80,7 @@ struct frame {
#define FILT_AVCTP 0x0800
#define FILT_ATT 0x1000
#define FILT_SMP 0x2000
+#define FILT_A2MP 0x4000
#define FILT_OBEX 0x00010000
#define FILT_CAPI 0x00020000
diff --git a/src/hcidump.c b/src/hcidump.c
index 0c13360..2513c7c 100644
--- a/src/hcidump.c
+++ b/src/hcidump.c
@@ -802,6 +802,7 @@ static struct {
{ "hci", FILT_HCI },
{ "sco", FILT_SCO },
{ "l2cap", FILT_L2CAP },
+ { "a2mp", FILT_A2MP },
{ "rfcomm", FILT_RFCOMM },
{ "sdp", FILT_SDP },
{ "bnep", FILT_BNEP },
--
1.7.7
--
Peter Krystad
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum
^ permalink raw reply related
* [PATCH 1/4] Add parsing of L2CAP Create/Move Channel signals
From: Peter Krystad @ 2011-10-21 23:29 UTC (permalink / raw)
To: linux-bluetooth; +Cc: andrei.emeltchenko, Peter Krystad
In-Reply-To: <1319239802-22457-1-git-send-email-pkrystad@codeaurora.org>
Add parsing of L2CAP Create/Move Channel signalling.
Example output:
2011-10-18 16:09:47.810208 > ACL data: handle 39 flags 0x02 dlen 13
L2CAP(s): Create req: psm 4097 scid 0x4201 id 17
2011-10-18 16:09:47.810269 < ACL data: handle 39 flags 0x00 dlen 16
L2CAP(s): Create rsp: dcid 0x0040 scid 0x4201 result 1 status 0
2011-10-18 16:09:47.898308 < ACL data: handle 39 flags 0x00 dlen 16
L2CAP(s): Create rsp: dcid 0x0040 scid 0x4201 result 0 status 0
....
2011-10-18 14:25:24.646869 > ACL data: handle 39 flags 0x02 dlen 11
L2CAP(s): Move req: icid 0x4000 id 17
2011-10-18 14:25:24.646987 < ACL data: handle 39 flags 0x00 dlen 12
L2CAP(s): Move rsp: icid 0x4000 result 1
2011-10-18 14:25:24.846873 < ACL data: handle 39 flags 0x00 dlen 12
L2CAP(s): Move rsp: icid 0x4000 result 0
2011-10-18 14:25:25.041844 > ACL data: handle 39 flags 0x02 dlen 12
L2CAP(s): Move cfm: icid 0x4000 result 0
2011-10-18 14:25:25.041945 < ACL data: handle 39 flags 0x00 dlen 10
L2CAP(s): Move cfm rsp: icid 0x4000
---
lib/l2cap.h | 50 +++++++++++++++++++++++++++++
parser/l2cap.c | 97 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 147 insertions(+), 0 deletions(-)
diff --git a/lib/l2cap.h b/lib/l2cap.h
index 3880551..b970a6e 100644
--- a/lib/l2cap.h
+++ b/lib/l2cap.h
@@ -82,6 +82,12 @@ struct l2cap_conninfo {
#define L2CAP_ECHO_RSP 0x09
#define L2CAP_INFO_REQ 0x0a
#define L2CAP_INFO_RSP 0x0b
+#define L2CAP_CREATE_REQ 0x0c
+#define L2CAP_CREATE_RSP 0x0d
+#define L2CAP_MOVE_REQ 0x0e
+#define L2CAP_MOVE_RSP 0x0f
+#define L2CAP_MOVE_CFM 0x10
+#define L2CAP_MOVE_CFM_RSP 0x11
/* L2CAP extended feature mask */
#define L2CAP_FEAT_FLOWCTL 0x00000001
@@ -270,6 +276,50 @@ typedef struct {
#define L2CAP_IR_SUCCESS 0x0000
#define L2CAP_IR_NOTSUPP 0x0001
+typedef struct {
+ uint16_t psm;
+ uint16_t scid;
+ uint8_t id;
+} __attribute__ ((packed)) l2cap_create_req;
+#define L2CAP_CREATE_REQ_SIZE 5
+
+typedef struct {
+ uint16_t dcid;
+ uint16_t scid;
+ uint16_t result;
+ uint16_t status;
+} __attribute__ ((packed)) l2cap_create_rsp;
+#define L2CAP_CREATE_RSP_SIZE 8
+
+typedef struct {
+ uint16_t icid;
+ uint8_t id;
+} __attribute__ ((packed)) l2cap_move_req;
+#define L2CAP_MOVE_REQ_SIZE 3
+
+typedef struct {
+ uint16_t icid;
+ uint16_t result;
+} __attribute__ ((packed)) l2cap_move_rsp;
+#define L2CAP_MOVE_RSP_SIZE 4
+
+typedef struct {
+ uint16_t icid;
+ uint16_t result;
+} __attribute__ ((packed)) l2cap_move_cfm;
+#define L2CAP_MOVE_CFM_SIZE 4
+
+typedef struct {
+ uint16_t icid;
+} __attribute__ ((packed)) l2cap_move_cfm_rsp;
+#define L2CAP_MOVE_CFM_RSP_SIZE 2
+
+/* info type */
+#define L2CAP_IT_CL_MTU 0x0001
+#define L2CAP_IT_FEAT_MASK 0x0002
+
+/* info result */
+#define L2CAP_IR_SUCCESS 0x0000
#ifdef __cplusplus
}
#endif
diff --git a/parser/l2cap.c b/parser/l2cap.c
index 6a5a4b2..7547e8b 100644
--- a/parser/l2cap.c
+++ b/parser/l2cap.c
@@ -399,6 +399,7 @@ static char *supervisory2str(uint8_t supervisory)
}
}
+
static inline void command_rej(int level, struct frame *frm)
{
l2cap_cmd_rej *h = frm->ptr;
@@ -850,6 +851,78 @@ static void l2cap_ctrl_parse(int level, struct frame *frm, uint32_t ctrl)
printf(" F-bit");
}
+static inline void create_req(int level, l2cap_cmd_hdr *cmd, struct frame *frm)
+{
+ l2cap_create_req *h = frm->ptr;
+ uint16_t psm = btohs(h->psm);
+ uint16_t scid = btohs(h->scid);
+
+ if (p_filter(FILT_L2CAP))
+ return;
+
+ printf("Create req: psm %d scid 0x%4.4x id %d\n", psm, scid, h->id);
+}
+
+static inline void create_rsp(int level, l2cap_cmd_hdr *cmd, struct frame *frm)
+{
+ l2cap_create_rsp *h = frm->ptr;
+ uint16_t scid = btohs(h->scid);
+ uint16_t dcid = btohs(h->dcid);
+ uint16_t result = btohs(h->result);
+ uint16_t status = btohs(h->status);
+
+ if (p_filter(FILT_L2CAP))
+ return;
+
+ printf("Create rsp: dcid 0x%4.4x scid 0x%4.4x result %d status %d\n", dcid, scid, result, status);
+}
+
+static inline void move_req(int level, l2cap_cmd_hdr *cmd, struct frame *frm)
+{
+ l2cap_move_req *h = frm->ptr;
+ uint16_t icid = btohs(h->icid);
+
+ if (p_filter(FILT_L2CAP))
+ return;
+
+ printf("Move req: icid 0x%4.4x id %d\n", icid, h->id);
+}
+
+static inline void move_rsp(int level, l2cap_cmd_hdr *cmd, struct frame *frm)
+{
+ l2cap_move_rsp *h = frm->ptr;
+ uint16_t icid = btohs(h->icid);
+ uint16_t result = btohs(h->result);
+
+ if (p_filter(FILT_L2CAP))
+ return;
+
+ printf("Move rsp: icid 0x%4.4x result %d\n", icid, result);
+}
+
+static inline void move_cfm(int level, l2cap_cmd_hdr *cmd, struct frame *frm)
+{
+ l2cap_move_cfm *h = frm->ptr;
+ uint16_t icid = btohs(h->icid);
+ uint16_t result = btohs(h->result);
+
+ if (p_filter(FILT_L2CAP))
+ return;
+
+ printf("Move cfm: icid 0x%4.4x result %d\n", icid, result);
+}
+
+static inline void move_cfm_rsp(int level, l2cap_cmd_hdr *cmd, struct frame *frm)
+{
+ l2cap_move_cfm_rsp *h = frm->ptr;
+ uint16_t icid = btohs(h->icid);
+
+ if (p_filter(FILT_L2CAP))
+ return;
+
+ printf("Move cfm rsp: icid 0x%4.4x\n", icid);
+}
+
static void l2cap_parse(int level, struct frame *frm)
{
l2cap_hdr *hdr = (void *)frm->ptr;
@@ -919,6 +992,30 @@ static void l2cap_parse(int level, struct frame *frm)
info_rsp(level, hdr, frm);
break;
+ case L2CAP_CREATE_REQ:
+ create_req(level, hdr, frm);
+ break;
+
+ case L2CAP_CREATE_RSP:
+ create_rsp(level, hdr, frm);
+ break;
+
+ case L2CAP_MOVE_REQ:
+ move_req(level, hdr, frm);
+ break;
+
+ case L2CAP_MOVE_RSP:
+ move_rsp(level, hdr, frm);
+ break;
+
+ case L2CAP_MOVE_CFM:
+ move_cfm(level, hdr, frm);
+ break;
+
+ case L2CAP_MOVE_CFM_RSP:
+ move_cfm_rsp(level, hdr, frm);
+ break;
+
default:
if (p_filter(FILT_L2CAP))
break;
--
1.7.7
--
Peter Krystad
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum
^ permalink raw reply related
* [PATCH 0/4] Add parsing of BT 3.0+HS signalling
From: Peter Krystad @ 2011-10-21 23:29 UTC (permalink / raw)
To: linux-bluetooth; +Cc: andrei.emeltchenko, Peter Krystad
This patchset adds parsing and display of BT 3.0+HS signalling
Peter Krystad (4):
Add parsing of L2CAP Create/Move Channel signals
Add parsing of A2MP signals
Add parsing of L2CAP Fixed Channel list
Minor cleanup of indentation in output
lib/amp.h | 133 +++++++++++++++
lib/l2cap.h | 50 ++++++
parser/hci.c | 15 +-
parser/l2cap.c | 498 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
parser/parser.h | 1 +
src/hcidump.c | 1 +
6 files changed, 693 insertions(+), 5 deletions(-)
create mode 100644 lib/amp.h
--
1.7.7
--
Peter Krystad
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum
^ permalink raw reply
* [U-Boot] [PATCH v2] Small refactor to remove duplicate serial code
From: Wolfgang Denk @ 2011-10-21 23:27 UTC (permalink / raw)
To: u-boot
In-Reply-To: <CAPnjgZ1QQMrp88B_iX-YewsqG6B+v2t3KGkyWg3X4sfFcw592w@mail.gmail.com>
Dear Simon Glass,
In message <CAPnjgZ1QQMrp88B_iX-YewsqG6B+v2t3KGkyWg3X4sfFcw592w@mail.gmail.com> you wrote:
>
> I really should update some patches in patchwork, as that might be
> causing you some difficulty. But I have lost my password. Do you know
> of any way to recover it?
Send email to JK and ask him to change / reset it.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
He had been eight years upon a project for extracting sunbeams out of
cucumbers, which were to be put in vials hermetically sealed, and let
out to warm the air in raw inclement summers. - Jonathan Swift
_Gulliver's Travels_ ``A Voyage to Laputa, etc.'' ch. 5
^ permalink raw reply
* [U-Boot] [PATCH] hwmon: Provide dtt_init()
From: Wolfgang Denk @ 2011-10-21 23:22 UTC (permalink / raw)
To: u-boot
In-Reply-To: <1318584192-3472-1-git-send-email-eibach@gdsys.de>
Dear Dirk Eibach,
In message <1318584192-3472-1-git-send-email-eibach@gdsys.de> you wrote:
> Our boards rely on dtt for initialization of fan hardware.
> dtt_init() was implemented to be called form board specific code.
>
> Signed-off-by: Dirk Eibach <eibach@gdsys.de>
> ---
> common/cmd_dtt.c | 42 +++++++++++++++++++++++++++++++++---------
> include/dtt.h | 1 +
> 2 files changed, 34 insertions(+), 9 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Die Freiheit des Menschen liegt nicht darin, dass er tun kann, was er
will, sondern darin, dass er nicht tun muss, was er nicht will.
-- Jean-Jacques Rousseau
^ permalink raw reply
* [U-Boot] [PATCH 2/2] common: cosmetic: CONFIG_BOOTFILE checkpatch compliance
From: Wolfgang Denk @ 2011-10-21 23:21 UTC (permalink / raw)
To: u-boot
In-Reply-To: <1318547028-20535-2-git-send-email-joe.hershberger@ni.com>
Dear Joe Hershberger,
In message <1318547028-20535-2-git-send-email-joe.hershberger@ni.com> you wrote:
> Remove MK_STR from places that consume CONFIG_BOOTFILE to force all definitions to be string literals.
>
> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
> Cc: Joe Hershberger <joe.hershberger@gmail.com>
> Cc: Wolfgang Denk <wd@denx.de>
> ---
> common/env_common.c | 2 +-
> common/env_embedded.c | 2 +-
> doc/README.usb | 2 +-
> include/configs/MPC8313ERDB.h | 2 +-
> include/configs/MPC8323ERDB.h | 2 +-
> include/configs/MPC8349EMDS.h | 2 +-
> include/configs/MPC8349ITX.h | 2 +-
> include/configs/MPC8360ERDK.h | 2 +-
> include/configs/MPC837XERDB.h | 2 +-
> include/configs/MPC8536DS.h | 2 +-
> include/configs/MPC8540ADS.h | 2 +-
> include/configs/MPC8541CDS.h | 2 +-
> include/configs/MPC8544DS.h | 2 +-
> include/configs/MPC8548CDS.h | 2 +-
> include/configs/MPC8555CDS.h | 2 +-
> include/configs/MPC8560ADS.h | 2 +-
> include/configs/MPC8568MDS.h | 2 +-
> include/configs/MPC8569MDS.h | 2 +-
> include/configs/MPC8572DS.h | 2 +-
> include/configs/MPC8610HPCD.h | 2 +-
> include/configs/MPC8641HPCN.h | 2 +-
> include/configs/P1010RDB.h | 2 +-
> include/configs/P1022DS.h | 2 +-
> include/configs/P1023RDS.h | 2 +-
> include/configs/P1_P2_RDB.h | 2 +-
> include/configs/P2020DS.h | 2 +-
> include/configs/P2041RDB.h | 2 +-
> include/configs/RPXlite_DW.h | 2 +-
> include/configs/SBC8540.h | 2 +-
> include/configs/SIMPC8313.h | 2 +-
> include/configs/am3517_crane.h | 2 +-
> include/configs/am3517_evm.h | 2 +-
> include/configs/aria.h | 2 +-
> include/configs/corenet_ds.h | 2 +-
> include/configs/debris.h | 2 +-
> include/configs/gr_cpci_ax2000.h | 2 +-
> include/configs/gr_ep2s60.h | 2 +-
> include/configs/gr_xc3s_1500.h | 2 +-
> include/configs/grsim.h | 2 +-
> include/configs/grsim_leon2.h | 2 +-
> include/configs/idmr.h | 2 +-
> include/configs/inka4x0.h | 2 +-
> include/configs/mecp5123.h | 2 +-
> include/configs/mpc5121ads.h | 2 +-
> include/configs/mpc7448hpc2.h | 2 +-
> include/configs/mpr2.h | 2 +-
> include/configs/ms7720se.h | 2 +-
> include/configs/omap3_evm.h | 2 +-
> include/configs/p1_p2_rdb_pc.h | 2 +-
> include/configs/sbc8349.h | 2 +-
> include/configs/sbc8548.h | 2 +-
> include/configs/sbc8560.h | 2 +-
> include/configs/sbc8641d.h | 2 +-
> include/configs/stxgp3.h | 2 +-
> include/configs/stxssa.h | 2 +-
> include/configs/vme8349.h | 2 +-
> tools/env/fw_env.c | 2 +-
> 57 files changed, 57 insertions(+), 57 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Why can you only have two doors on a chicken coop? If it had four it
would be a chicken sedan.
^ permalink raw reply
* [U-Boot] [PATCH 1/2] common: cosmetic: CONFIG_ROOTPATH checkpatch compliance
From: Wolfgang Denk @ 2011-10-21 23:21 UTC (permalink / raw)
To: u-boot
In-Reply-To: <1318547028-20535-1-git-send-email-joe.hershberger@ni.com>
Dear Joe Hershberger,
In message <1318547028-20535-1-git-send-email-joe.hershberger@ni.com> you wrote:
> Remove MK_STR from places that consume CONFIG_ROOTPATH to force all definitions to be string literals.
>
> Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
> Cc: Joe Hershberger <joe.hershberger@gmail.com>
> Cc: Wolfgang Denk <wd@denx.de>
> ---
> common/env_common.c | 2 +-
> common/env_embedded.c | 2 +-
> include/configs/DB64360.h | 2 +-
> include/configs/DB64460.h | 2 +-
> include/configs/MPC8313ERDB.h | 2 +-
> include/configs/MPC8323ERDB.h | 2 +-
> include/configs/MPC8349EMDS.h | 2 +-
> include/configs/MPC8349ITX.h | 4 ++--
> include/configs/MPC8360ERDK.h | 2 +-
> include/configs/MPC837XERDB.h | 2 +-
> include/configs/MPC8536DS.h | 2 +-
> include/configs/MPC8540ADS.h | 2 +-
> include/configs/MPC8541CDS.h | 2 +-
> include/configs/MPC8544DS.h | 2 +-
> include/configs/MPC8548CDS.h | 2 +-
> include/configs/MPC8555CDS.h | 2 +-
> include/configs/MPC8560ADS.h | 2 +-
> include/configs/MPC8568MDS.h | 2 +-
> include/configs/MPC8569MDS.h | 2 +-
> include/configs/MPC8572DS.h | 2 +-
> include/configs/MPC8610HPCD.h | 2 +-
> include/configs/MPC8641HPCN.h | 2 +-
> include/configs/P1010RDB.h | 2 +-
> include/configs/P1022DS.h | 2 +-
> include/configs/P1_P2_RDB.h | 2 +-
> include/configs/P2020DS.h | 2 +-
> include/configs/P2041RDB.h | 2 +-
> include/configs/PN62.h | 2 +-
> include/configs/RPXlite_DW.h | 2 +-
> include/configs/RRvision.h | 2 +-
> include/configs/SBC8540.h | 2 +-
> include/configs/SIMPC8313.h | 2 +-
> include/configs/aria.h | 2 +-
> include/configs/bct-brettl2.h | 2 +-
> include/configs/bf537-minotaur.h | 2 +-
> include/configs/bf537-srv1.h | 2 +-
> include/configs/bfin_adi_common.h | 2 +-
> include/configs/blackstamp.h | 2 +-
> include/configs/blackvme.h | 2 +-
> include/configs/corenet_ds.h | 2 +-
> include/configs/debris.h | 2 +-
> include/configs/dnp5370.h | 2 +-
> include/configs/gr_cpci_ax2000.h | 2 +-
> include/configs/gr_ep2s60.h | 2 +-
> include/configs/gr_xc3s_1500.h | 2 +-
> include/configs/grsim.h | 2 +-
> include/configs/grsim_leon2.h | 2 +-
> include/configs/idmr.h | 2 +-
> include/configs/inka4x0.h | 2 +-
> include/configs/mecp5123.h | 2 +-
> include/configs/mpc5121ads.h | 2 +-
> include/configs/p1_p2_rdb_pc.h | 2 +-
> include/configs/pm9263.h | 2 +-
> include/configs/quantum.h | 2 +-
> include/configs/sbc8349.h | 2 +-
> include/configs/sbc8548.h | 2 +-
> include/configs/sbc8560.h | 2 +-
> include/configs/sbc8641d.h | 2 +-
> include/configs/stxgp3.h | 2 +-
> include/configs/stxssa.h | 2 +-
> include/configs/vme8349.h | 2 +-
> tools/env/fw_env.c | 2 +-
> 62 files changed, 63 insertions(+), 63 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Every revolutionary idea - in science, politics, art, or whatever -
evokes three stages of reaction in a hearer:
1. It is completely impossible - don't waste my time.
2. It is possible, but it is not worth doing.
3. I said it was a good idea all along.
^ permalink raw reply
* [U-Boot] [PATCH] autoconf.mk.dep: use target cflags, not host
From: Wolfgang Denk @ 2011-10-21 23:20 UTC (permalink / raw)
To: u-boot
In-Reply-To: <1318484880-12910-1-git-send-email-vapier@gentoo.org>
Dear Mike Frysinger,
In message <1318484880-12910-1-git-send-email-vapier@gentoo.org> you wrote:
> The current autoconf.mk.dep rule uses the host cflags when executing the
> target compiler (which includes target header files). We don't want to
> mix the target compiler and host compiler flags, so change it to CFLAGS.
> Otherwise we get things like -pedantic which the U-Boot source code does
> not build with.
>
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> ---
> Makefile | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
CONSUMER NOTICE: Because of the "Uncertainty Principle," It Is
Impossible for the Consumer to Find Out at the Same Time Both
Precisely Where This Product Is and How Fast It Is Moving.
^ permalink raw reply
* [U-Boot] [PATCH 2/2] build: force migration away from $(AR)
From: Wolfgang Denk @ 2011-10-21 23:19 UTC (permalink / raw)
To: u-boot
In-Reply-To: <1318483520-2035-2-git-send-email-vapier@gentoo.org>
Dear Mike Frysinger,
In message <1318483520-2035-2-git-send-email-vapier@gentoo.org> you wrote:
> People keep adding new code that still uses $(AR) instead of
> $(cmd_link_o_target), so turn it into a build time error.
>
> We still use $(AR) locally, but we don't use $(ARFLAGS).
>
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> ---
> config.mk | 8 +++-----
> 1 files changed, 3 insertions(+), 5 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Conceptual integrity in turn dictates that the design must proceed
from one mind, or from a very small number of agreeing resonant
minds. - Frederick Brooks Jr., "The Mythical Man Month"
^ permalink raw reply
* [U-Boot] [PATCH 1/2 v2] build: add missing $(AR)->$(cmd_link_o_target) update
From: Wolfgang Denk @ 2011-10-21 23:18 UTC (permalink / raw)
To: u-boot
In-Reply-To: <1318951817-28006-1-git-send-email-vapier@gentoo.org>
Dear Mike Frysinger,
In message <1318951817-28006-1-git-send-email-vapier@gentoo.org> you wrote:
> Seems people fixed their files to use libfoo.o, but didn't actually
> update the creation targets to use $(cmd_link_o_target). Update the
> rest of the Makefile's found with grep.
>
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> ---
> v2
> - fixup new sandbox makefile too
>
> arch/arm/cpu/arm926ejs/armada100/Makefile | 2 +-
> arch/arm/cpu/arm926ejs/pantheon/Makefile | 2 +-
> arch/arm/cpu/armv7/tegra2/Makefile | 2 +-
> board/Marvell/aspenite/Makefile | 2 +-
> board/Marvell/dkb/Makefile | 2 +-
> board/Marvell/gplugd/Makefile | 2 +-
> board/cm_t35/Makefile | 2 +-
> board/davinci/ea20/Makefile | 2 +-
> board/freescale/p1023rds/Makefile | 2 +-
> board/matrix_vision/mergerbox/Makefile | 2 +-
> board/nvidia/harmony/Makefile | 2 +-
> board/nvidia/seaboard/Makefile | 2 +-
> board/samsung/origen/Makefile | 2 +-
> board/samsung/smdkv310/Makefile | 2 +-
> board/sandbox/sandbox/Makefile | 2 +-
> board/shmin/Makefile | 2 +-
> 16 files changed, 16 insertions(+), 16 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Where there's no emotion, there's no motive for violence.
-- Spock, "Dagger of the Mind", stardate 2715.1
^ permalink raw reply
* [U-Boot] [PATCH] consolidate mdelay by providing a common function for all users
From: Wolfgang Denk @ 2011-10-21 23:16 UTC (permalink / raw)
To: u-boot
In-Reply-To: <1318422699-9394-1-git-send-email-agust@denx.de>
Dear Anatolij Gustschin,
In message <1318422699-9394-1-git-send-email-agust@denx.de> you wrote:
> There are several mdelay() definitions in the driver and
> board code. Remove them all and provide a common mdelay()
> in lib/time.c.
>
> Signed-off-by: Anatolij Gustschin <agust@denx.de>
> ---
> arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c | 1 -
> arch/mips/cpu/mips32/au1x00/au1x00_usb_ohci.c | 1 -
> arch/powerpc/cpu/mpc5xxx/usb_ohci.c | 1 -
> arch/powerpc/cpu/ppc4xx/usb_ohci.c | 1 -
> arch/powerpc/include/asm/4xx_pcie.h | 8 --------
> board/amcc/taishan/lcd.c | 2 --
> board/freescale/mx35pdk/mx35pdk.c | 2 --
> board/karo/tx25/tx25.c | 6 ------
> board/linkstation/hwctl.c | 2 --
> drivers/block/fsl_sata.c | 7 -------
> drivers/block/ftide020.c | 2 --
> drivers/net/e1000.c | 1 -
> drivers/net/ftgmac100.c | 2 --
> drivers/net/ne2000.c | 1 -
> drivers/net/ne2000_base.c | 1 -
> drivers/net/smc911x.c | 2 --
> drivers/usb/host/ohci-hcd.c | 1 -
> drivers/usb/host/sl811-hcd.c | 2 --
> include/common.h | 1 +
> lib/time.c | 6 ++++++
> 20 files changed, 7 insertions(+), 43 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
... Jesus cried with a loud voice: Lazarus, come forth; the bug hath
been found and thy program runneth. And he that was dead came
forth... -- John 11:43-44 [version 2.0?]
^ permalink raw reply
* [U-Boot] [PATCH v2 REPOST 1/3] [COSMETIC] checkpatch whitespace cleanups
From: Wolfgang Denk @ 2011-10-21 23:13 UTC (permalink / raw)
To: u-boot
In-Reply-To: <1318972311-673-1-git-send-email-swarren@nvidia.com>
Dear Stephen Warren,
In message <1318972311-673-1-git-send-email-swarren@nvidia.com> you wrote:
> This avoids the following checkpatch warning in later patches:
>
> ERROR: "(foo*)" should be "(foo *)"
> ERROR: space required before the open brace '{'
> ERROR: space prohibited before that close parenthesis ')'
> ERROR: spaces required around that '||' (ctx:WxV)
> WARNING: space prohibited between function name and open parenthesis '('
> WARNING: line over 80 characters
>
> This fixes all the white-space warnings/errors in my subsequent patch,
> and within this current patch. A number of other checkpatch warnings
> and errors are still present in this patch itself, but are beyond simple
> whitespace fixes, so are not solved by this patch.
>
> v2: New patch
>
> Signed-off-by: Stephen Warren <swarren@nvidia.com>
> ---
> common/cmd_bootm.c | 547 ++++++++++++-----------
> common/cmd_ximg.c | 72 ++--
> common/image.c | 1187 ++++++++++++++++++++++++++-----------------------
> common/lynxkdi.c | 34 +-
> include/image.h | 230 +++++-----
> tools/default_image.c | 56 ++--
> 6 files changed, 1101 insertions(+), 1025 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
When it is incorrect, it is, at least *authoritatively* incorrect.
- Hitchiker's Guide To The Galaxy
^ permalink raw reply
* [PATCH] net: use INET_ECN_MASK instead of hardcoded 3
From: Maciej Żenczykowski @ 2011-10-21 23:11 UTC (permalink / raw)
To: Maciej Żenczykowski; +Cc: netdev, Maciej Żenczykowski
From: Maciej Żenczykowski <maze@google.com>
Signed-off-by: Maciej Żenczykowski <maze@google.com>
---
net/ipv4/ip_sockglue.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index f0dc3ad..09ff51b 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -33,6 +33,7 @@
#include <linux/netfilter.h>
#include <linux/route.h>
#include <linux/mroute.h>
+#include <net/inet_ecn.h>
#include <net/route.h>
#include <net/xfrm.h>
#include <net/compat.h>
@@ -578,8 +579,8 @@ static int do_ip_setsockopt(struct sock *sk, int level,
break;
case IP_TOS: /* This sets both TOS and Precedence */
if (sk->sk_type == SOCK_STREAM) {
- val &= ~3;
- val |= inet->tos & 3;
+ val &= ~INET_ECN_MASK;
+ val |= inet->tos & INET_ECN_MASK;
}
if (inet->tos != val) {
inet->tos = val;
--
1.7.3.1
^ permalink raw reply related
* [RFC][PATCH 2/2] PM / Domains: Add default power off governor function (v2)
From: Rafael J. Wysocki @ 2011-10-21 23:11 UTC (permalink / raw)
To: Linux PM list; +Cc: LKML, Linux-sh list, Jean Pihet, Magnus Damm
In-Reply-To: <201110220109.52991.rjw@sisk.pl>
From: Rafael J. Wysocki <rjw@sisk.pl>
Add a function deciding whether or not a given PM domain should
be powered off on the basis of that domain's devices' PM QoS
constraints.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
drivers/base/power/domain_governor.c | 96 +++++++++++++++++++++++++++++++++++
include/linux/pm_domain.h | 7 ++
2 files changed, 103 insertions(+)
Index: linux/include/linux/pm_domain.h
=================================--- linux.orig/include/linux/pm_domain.h
+++ linux/include/linux/pm_domain.h
@@ -49,6 +49,10 @@ struct generic_pm_domain {
int (*start_device)(struct device *dev);
int (*stop_device)(struct device *dev);
bool (*active_wakeup)(struct device *dev);
+ ktime_t power_off_latency;
+ ktime_t power_on_latency;
+ s64 break_even_ns;
+ s64 min_delta_ns;
};
static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd)
@@ -64,6 +68,9 @@ struct gpd_link {
};
struct gpd_gov_dev_data {
+ ktime_t start_latency;
+ ktime_t suspend_latency;
+ ktime_t resume_latency;
s64 break_even_ns;
};
Index: linux/drivers/base/power/domain_governor.c
=================================--- linux.orig/drivers/base/power/domain_governor.c
+++ linux/drivers/base/power/domain_governor.c
@@ -35,6 +35,102 @@ bool default_stop_ok(struct device *dev)
return constraint_ns > gov_data->break_even_ns;
}
+/* This routine must be executed under the PM domain's lock. */
+static bool default_power_down_ok(struct dev_pm_domain *pd)
+{
+ struct generic_pm_domain *genpd = pd_to_genpd(pd);
+ struct gpd_link *link;
+ struct pm_domain_data *pdd;
+ ktime_t off_time, on_time;
+ s64 delta_ns, min_delta_ns;
+
+ on_time = genpd->power_on_latency;
+ /* Check if slave domains can be off for enough time. */
+ delta_ns = ktime_to_ns(ktime_add(genpd->power_off_latency, on_time));
+ min_delta_ns = 0;
+ /* All slave domains have been powered off at this point. */
+ list_for_each_entry(link, &genpd->master_links, master_node) {
+ if (delta_ns > link->slave->min_delta_ns)
+ return false;
+
+ delta_ns = link->slave->min_delta_ns - delta_ns;
+ if (delta_ns < min_delta_ns)
+ min_delta_ns = delta_ns;
+ }
+
+ genpd->min_delta_ns = min_delta_ns;
+
+ /* Compute the total time needed to power off the domain. */
+ off_time = ktime_set(0, 0);
+ /* All devices have been stopped at this point. */
+ list_for_each_entry(pdd, &genpd->dev_list, list_node) {
+ struct gpd_gov_dev_data *gov_data;
+
+ if (!pdd->dev->driver)
+ continue;
+
+ gov_data = to_gpd_data(pdd)->gov_data;
+ if (!gov_data)
+ continue;
+
+ off_time = ktime_add(off_time, gov_data->suspend_latency);
+ }
+ off_time = ktime_add(off_time, genpd->power_off_latency);
+
+ /*
+ * For each device in the domain compute the difference between the
+ * QoS value and the total time required to bring the device back
+ * assuming that the domain will be powered off and compute the minimum
+ * of those.
+ */
+ min_delta_ns = 0;
+ on_time = ktime_add(on_time, off_time);
+ list_for_each_entry(pdd, &genpd->dev_list, list_node) {
+ struct gpd_gov_dev_data *gov_data;
+ struct device *dev = pdd->dev;
+ ktime_t dev_up_time;
+ s32 constraint;
+ s64 constraint_ns;
+
+ if (!dev->driver)
+ continue;
+
+ gov_data = to_gpd_data(pdd)->gov_data;
+ if (gov_data) {
+ dev_up_time = ktime_add(on_time,
+ gov_data->resume_latency);
+ dev_up_time = ktime_add(dev_up_time,
+ gov_data->start_latency);
+ } else {
+ dev_up_time = on_time;
+ }
+
+ constraint = dev_pm_qos_read_value(dev);
+ if (constraint < 0)
+ return false;
+ else if (constraint = 0) /* 0 means "don't care" */
+ continue;
+
+ constraint_ns = constraint;
+ constraint_ns *= NSEC_PER_USEC;
+ delta_ns = constraint_ns - ktime_to_ns(dev_up_time);
+ if (min_delta_ns > delta_ns)
+ min_delta_ns = delta_ns;
+ }
+
+ /* Compare the computed delta with the break even value. */
+ if (min_delta_ns < genpd->break_even_ns)
+ return false;
+
+ /* Store the computed value for the masters to use. */
+ if (genpd->min_delta_ns > min_delta_ns)
+ genpd->min_delta_ns = min_delta_ns;
+
+ /* The domain can be powered off. */
+ return true;
+}
+
struct dev_power_governor simple_qos_governor = {
.stop_ok = default_stop_ok,
+ .power_down_ok = default_power_down_ok,
};
^ permalink raw reply
* [U-Boot] [PATCH 2/2] am335x: Drop board_sysinfo struct
From: Albert ARIBAUD @ 2011-10-21 23:10 UTC (permalink / raw)
To: u-boot
In-Reply-To: <1319235787-435-3-git-send-email-trini@ti.com>
Hi Tom,
Le 22/10/2011 00:23, Tom Rini a ?crit :
> This isn't used presumably should be a typedef if needed later.
Note: IIUC, typedefs are frowned upon in U-Boot.
Amicalement,
--
Albert.
^ permalink raw reply
* [RFC][PATCH 1/2] PM / Domains: Add device stop governor function (v2)
From: Rafael J. Wysocki @ 2011-10-21 23:10 UTC (permalink / raw)
To: Linux PM list; +Cc: LKML, Linux-sh list, Jean Pihet, Magnus Damm
In-Reply-To: <201110220109.52991.rjw@sisk.pl>
From: Rafael J. Wysocki <rjw@sisk.pl>
Add a function deciding whether or not devices should be
stopped in pm_genpd_runtime_suspend() depending on their
PM QoS values.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
arch/arm/mach-shmobile/pm-sh7372.c | 4 ++-
drivers/base/power/Makefile | 2 -
drivers/base/power/domain.c | 29 ++++++++++++++++++----
drivers/base/power/domain_governor.c | 40 +++++++++++++++++++++++++++++++
include/linux/pm_domain.h | 45 +++++++++++++++++++++++++++++++----
5 files changed, 109 insertions(+), 11 deletions(-)
Index: linux/include/linux/pm_domain.h
=================================--- linux.orig/include/linux/pm_domain.h
+++ linux/include/linux/pm_domain.h
@@ -21,6 +21,7 @@ enum gpd_status {
struct dev_power_governor {
bool (*power_down_ok)(struct dev_pm_domain *domain);
+ bool (*stop_ok)(struct device *dev);
};
struct generic_pm_domain {
@@ -62,8 +63,13 @@ struct gpd_link {
struct list_head slave_node;
};
+struct gpd_gov_dev_data {
+ s64 break_even_ns;
+};
+
struct generic_pm_domain_data {
struct pm_domain_data base;
+ struct gpd_gov_dev_data *gov_data;
bool need_restore;
};
@@ -73,8 +79,19 @@ static inline struct generic_pm_domain_d
}
#ifdef CONFIG_PM_GENERIC_DOMAINS
-extern int pm_genpd_add_device(struct generic_pm_domain *genpd,
- struct device *dev);
+extern struct dev_power_governor simple_qos_governor;
+
+extern struct generic_pm_domain *dev_to_genpd(struct device *dev);
+extern int __pm_genpd_add_device(struct generic_pm_domain *genpd,
+ struct device *dev,
+ struct gpd_gov_dev_data *gov_data);
+
+static inline int pm_genpd_add_device(struct generic_pm_domain *genpd,
+ struct device *dev)
+{
+ return __pm_genpd_add_device(genpd, dev, NULL);
+}
+
extern int pm_genpd_remove_device(struct generic_pm_domain *genpd,
struct device *dev);
extern int pm_genpd_add_subdomain(struct generic_pm_domain *genpd,
@@ -83,8 +100,23 @@ extern int pm_genpd_remove_subdomain(str
struct generic_pm_domain *target);
extern void pm_genpd_init(struct generic_pm_domain *genpd,
struct dev_power_governor *gov, bool is_off);
+
extern int pm_genpd_poweron(struct generic_pm_domain *genpd);
+
+extern bool default_stop_ok(struct device *dev);
+
#else
+
+static inline struct generic_pm_domain *dev_to_genpd(struct device *dev)
+{
+ return ERR_PTR(-ENOSYS);
+}
+static inline int __pm_genpd_add_device(struct generic_pm_domain *genpd,
+ struct device *dev,
+ struct gpd_gov_dev_data *gov_data)
+{
+ return -ENOSYS;
+}
static inline int pm_genpd_add_device(struct generic_pm_domain *genpd,
struct device *dev)
{
@@ -105,12 +137,17 @@ static inline int pm_genpd_remove_subdom
{
return -ENOSYS;
}
-static inline void pm_genpd_init(struct generic_pm_domain *genpd,
- struct dev_power_governor *gov, bool is_off) {}
+static inline void pm_genpd_init(struct generic_pm_domain *genpd, bool is_off)
+{
+}
static inline int pm_genpd_poweron(struct generic_pm_domain *genpd)
{
return -ENOSYS;
}
+static inline bool default_stop_ok(struct device *dev)
+{
+ return false;
+}
#endif
#ifdef CONFIG_PM_GENERIC_DOMAINS_RUNTIME
Index: linux/drivers/base/power/domain.c
=================================--- linux.orig/drivers/base/power/domain.c
+++ linux/drivers/base/power/domain.c
@@ -21,7 +21,7 @@ static DEFINE_MUTEX(gpd_list_lock);
#ifdef CONFIG_PM
-static struct generic_pm_domain *dev_to_genpd(struct device *dev)
+struct generic_pm_domain *dev_to_genpd(struct device *dev)
{
if (IS_ERR_OR_NULL(dev->pm_domain))
return ERR_PTR(-EINVAL);
@@ -403,6 +403,22 @@ static void genpd_power_off_work_fn(stru
}
/**
+ * genpd_stop_dev - Stop a given device if that's beneficial.
+ * @genpd: PM domain the device belongs to.
+ * @dev: Device to stop.
+ */
+static int genpd_stop_dev(struct generic_pm_domain *genpd, struct device *dev)
+{
+ bool (*stop_ok)(struct device *dev);
+
+ stop_ok = genpd->gov ? genpd->gov->stop_ok : NULL;
+ if (stop_ok && !stop_ok(dev))
+ return -EBUSY;
+
+ return genpd->stop_device(dev);
+}
+
+/**
* pm_genpd_runtime_suspend - Suspend a device belonging to I/O PM domain.
* @dev: Device to suspend.
*
@@ -423,7 +439,7 @@ static int pm_genpd_runtime_suspend(stru
might_sleep_if(!genpd->dev_irq_safe);
if (genpd->stop_device) {
- int ret = genpd->stop_device(dev);
+ int ret = genpd_stop_dev(genpd, dev);
if (ret)
return ret;
}
@@ -495,7 +511,7 @@ static int pm_genpd_runtime_resume(struc
mutex_lock(&genpd->lock);
}
finish_wait(&genpd->status_wait_queue, &wait);
- __pm_genpd_restore_device(dev->power.subsys_data->domain_data, genpd);
+ __pm_genpd_restore_device(dev_to_psd(dev)->domain_data, genpd);
genpd->resume_count--;
genpd_set_active(genpd);
wake_up_all(&genpd->status_wait_queue);
@@ -1076,11 +1092,13 @@ static void pm_genpd_complete(struct dev
#endif /* CONFIG_PM_SLEEP */
/**
- * pm_genpd_add_device - Add a device to an I/O PM domain.
+ * __pm_genpd_add_device - Add a device to an I/O PM domain.
* @genpd: PM domain to add the device to.
* @dev: Device to be added.
+ * @gov_data: Set of PM QoS parameters to attach to the device.
*/
-int pm_genpd_add_device(struct generic_pm_domain *genpd, struct device *dev)
+int __pm_genpd_add_device(struct generic_pm_domain *genpd, struct device *dev,
+ struct gpd_gov_dev_data *gov_data)
{
struct generic_pm_domain_data *gpd_data;
struct pm_domain_data *pdd;
@@ -1123,6 +1141,7 @@ int pm_genpd_add_device(struct generic_p
gpd_data->base.dev = dev;
gpd_data->need_restore = false;
list_add_tail(&gpd_data->base.list_node, &genpd->dev_list);
+ gpd_data->gov_data = gov_data;
out:
genpd_release_lock(genpd);
Index: linux/drivers/base/power/Makefile
=================================--- linux.orig/drivers/base/power/Makefile
+++ linux/drivers/base/power/Makefile
@@ -3,7 +3,7 @@ obj-$(CONFIG_PM_SLEEP) += main.o wakeup.
obj-$(CONFIG_PM_RUNTIME) += runtime.o
obj-$(CONFIG_PM_TRACE_RTC) += trace.o
obj-$(CONFIG_PM_OPP) += opp.o
-obj-$(CONFIG_PM_GENERIC_DOMAINS) += domain.o
+obj-$(CONFIG_PM_GENERIC_DOMAINS) += domain.o domain_governor.o
obj-$(CONFIG_HAVE_CLK) += clock_ops.o
ccflags-$(CONFIG_DEBUG_DRIVER) := -DDEBUG
Index: linux/drivers/base/power/domain_governor.c
=================================--- /dev/null
+++ linux/drivers/base/power/domain_governor.c
@@ -0,0 +1,40 @@
+/*
+ * drivers/base/power/domain_governor.c - Governors for device PM domains.
+ *
+ * Copyright (C) 2011 Rafael J. Wysocki <rjw@sisk.pl>, Renesas Electronics Corp.
+ *
+ * This file is released under the GPLv2.
+ */
+
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/pm_domain.h>
+#include <linux/pm_qos.h>
+
+bool default_stop_ok(struct device *dev)
+{
+ struct gpd_gov_dev_data *gov_data;
+ s64 constraint_ns;
+ s32 constraint;
+
+ dev_dbg(dev, "%s()\n", __func__);
+
+ gov_data = to_gpd_data(dev_to_psd(dev)->domain_data)->gov_data;
+ if (!gov_data)
+ return true;
+
+ constraint = dev_pm_qos_read_value(dev);
+ if (constraint < 0)
+ return false;
+ else if (constraint = 0) /* 0 means "don't care" */
+ return true;
+
+ constraint_ns = constraint;
+ constraint_ns *= NSEC_PER_USEC;
+
+ return constraint_ns > gov_data->break_even_ns;
+}
+
+struct dev_power_governor simple_qos_governor = {
+ .stop_ok = default_stop_ok,
+};
Index: linux/arch/arm/mach-shmobile/pm-sh7372.c
=================================--- linux.orig/arch/arm/mach-shmobile/pm-sh7372.c
+++ linux/arch/arm/mach-shmobile/pm-sh7372.c
@@ -161,13 +161,15 @@ static bool sh7372_power_down_forbidden(
struct dev_power_governor sh7372_always_on_gov = {
.power_down_ok = sh7372_power_down_forbidden,
+ .stop_ok = default_stop_ok,
};
void sh7372_init_pm_domain(struct sh7372_pm_domain *sh7372_pd)
{
struct generic_pm_domain *genpd = &sh7372_pd->genpd;
+ struct dev_power_governor *gov = sh7372_pd->gov;
- pm_genpd_init(genpd, sh7372_pd->gov, false);
+ pm_genpd_init(genpd, gov ? : &simple_qos_governor, false);
genpd->stop_device = pm_clk_suspend;
genpd->start_device = pm_clk_resume;
genpd->dev_irq_safe = true;
^ permalink raw reply
* [RFC][PATCH 0/2] PM: Generic PM domains and device PM QoS (v2)
From: Rafael J. Wysocki @ 2011-10-21 23:09 UTC (permalink / raw)
To: Linux PM list; +Cc: LKML, Linux-sh list, Jean Pihet, Magnus Damm
Hi,
This patchset is a refresh of patches introducing simple PM QoS governor
functions for PM domains. The patches still haven't been tested properly,
although they should build. The purpose of them is mainly to illustrate
how PM QoS may be used with PM domains to control device runtime PM.
Thanks,
Rafael
^ permalink raw reply
* [RFC][PATCH 2/2] PM / Domains: Add default power off governor function (v2)
From: Rafael J. Wysocki @ 2011-10-21 23:11 UTC (permalink / raw)
To: Linux PM list; +Cc: LKML, Linux-sh list, Jean Pihet, Magnus Damm
In-Reply-To: <201110220109.52991.rjw@sisk.pl>
From: Rafael J. Wysocki <rjw@sisk.pl>
Add a function deciding whether or not a given PM domain should
be powered off on the basis of that domain's devices' PM QoS
constraints.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
drivers/base/power/domain_governor.c | 96 +++++++++++++++++++++++++++++++++++
include/linux/pm_domain.h | 7 ++
2 files changed, 103 insertions(+)
Index: linux/include/linux/pm_domain.h
===================================================================
--- linux.orig/include/linux/pm_domain.h
+++ linux/include/linux/pm_domain.h
@@ -49,6 +49,10 @@ struct generic_pm_domain {
int (*start_device)(struct device *dev);
int (*stop_device)(struct device *dev);
bool (*active_wakeup)(struct device *dev);
+ ktime_t power_off_latency;
+ ktime_t power_on_latency;
+ s64 break_even_ns;
+ s64 min_delta_ns;
};
static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd)
@@ -64,6 +68,9 @@ struct gpd_link {
};
struct gpd_gov_dev_data {
+ ktime_t start_latency;
+ ktime_t suspend_latency;
+ ktime_t resume_latency;
s64 break_even_ns;
};
Index: linux/drivers/base/power/domain_governor.c
===================================================================
--- linux.orig/drivers/base/power/domain_governor.c
+++ linux/drivers/base/power/domain_governor.c
@@ -35,6 +35,102 @@ bool default_stop_ok(struct device *dev)
return constraint_ns > gov_data->break_even_ns;
}
+/* This routine must be executed under the PM domain's lock. */
+static bool default_power_down_ok(struct dev_pm_domain *pd)
+{
+ struct generic_pm_domain *genpd = pd_to_genpd(pd);
+ struct gpd_link *link;
+ struct pm_domain_data *pdd;
+ ktime_t off_time, on_time;
+ s64 delta_ns, min_delta_ns;
+
+ on_time = genpd->power_on_latency;
+ /* Check if slave domains can be off for enough time. */
+ delta_ns = ktime_to_ns(ktime_add(genpd->power_off_latency, on_time));
+ min_delta_ns = 0;
+ /* All slave domains have been powered off at this point. */
+ list_for_each_entry(link, &genpd->master_links, master_node) {
+ if (delta_ns > link->slave->min_delta_ns)
+ return false;
+
+ delta_ns = link->slave->min_delta_ns - delta_ns;
+ if (delta_ns < min_delta_ns)
+ min_delta_ns = delta_ns;
+ }
+
+ genpd->min_delta_ns = min_delta_ns;
+
+ /* Compute the total time needed to power off the domain. */
+ off_time = ktime_set(0, 0);
+ /* All devices have been stopped at this point. */
+ list_for_each_entry(pdd, &genpd->dev_list, list_node) {
+ struct gpd_gov_dev_data *gov_data;
+
+ if (!pdd->dev->driver)
+ continue;
+
+ gov_data = to_gpd_data(pdd)->gov_data;
+ if (!gov_data)
+ continue;
+
+ off_time = ktime_add(off_time, gov_data->suspend_latency);
+ }
+ off_time = ktime_add(off_time, genpd->power_off_latency);
+
+ /*
+ * For each device in the domain compute the difference between the
+ * QoS value and the total time required to bring the device back
+ * assuming that the domain will be powered off and compute the minimum
+ * of those.
+ */
+ min_delta_ns = 0;
+ on_time = ktime_add(on_time, off_time);
+ list_for_each_entry(pdd, &genpd->dev_list, list_node) {
+ struct gpd_gov_dev_data *gov_data;
+ struct device *dev = pdd->dev;
+ ktime_t dev_up_time;
+ s32 constraint;
+ s64 constraint_ns;
+
+ if (!dev->driver)
+ continue;
+
+ gov_data = to_gpd_data(pdd)->gov_data;
+ if (gov_data) {
+ dev_up_time = ktime_add(on_time,
+ gov_data->resume_latency);
+ dev_up_time = ktime_add(dev_up_time,
+ gov_data->start_latency);
+ } else {
+ dev_up_time = on_time;
+ }
+
+ constraint = dev_pm_qos_read_value(dev);
+ if (constraint < 0)
+ return false;
+ else if (constraint == 0) /* 0 means "don't care" */
+ continue;
+
+ constraint_ns = constraint;
+ constraint_ns *= NSEC_PER_USEC;
+ delta_ns = constraint_ns - ktime_to_ns(dev_up_time);
+ if (min_delta_ns > delta_ns)
+ min_delta_ns = delta_ns;
+ }
+
+ /* Compare the computed delta with the break even value. */
+ if (min_delta_ns < genpd->break_even_ns)
+ return false;
+
+ /* Store the computed value for the masters to use. */
+ if (genpd->min_delta_ns > min_delta_ns)
+ genpd->min_delta_ns = min_delta_ns;
+
+ /* The domain can be powered off. */
+ return true;
+}
+
struct dev_power_governor simple_qos_governor = {
.stop_ok = default_stop_ok,
+ .power_down_ok = default_power_down_ok,
};
^ permalink raw reply
* [RFC][PATCH 1/2] PM / Domains: Add device stop governor function (v2)
From: Rafael J. Wysocki @ 2011-10-21 23:10 UTC (permalink / raw)
To: Linux PM list; +Cc: LKML, Linux-sh list, Jean Pihet, Magnus Damm
In-Reply-To: <201110220109.52991.rjw@sisk.pl>
From: Rafael J. Wysocki <rjw@sisk.pl>
Add a function deciding whether or not devices should be
stopped in pm_genpd_runtime_suspend() depending on their
PM QoS values.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
arch/arm/mach-shmobile/pm-sh7372.c | 4 ++-
drivers/base/power/Makefile | 2 -
drivers/base/power/domain.c | 29 ++++++++++++++++++----
drivers/base/power/domain_governor.c | 40 +++++++++++++++++++++++++++++++
include/linux/pm_domain.h | 45 +++++++++++++++++++++++++++++++----
5 files changed, 109 insertions(+), 11 deletions(-)
Index: linux/include/linux/pm_domain.h
===================================================================
--- linux.orig/include/linux/pm_domain.h
+++ linux/include/linux/pm_domain.h
@@ -21,6 +21,7 @@ enum gpd_status {
struct dev_power_governor {
bool (*power_down_ok)(struct dev_pm_domain *domain);
+ bool (*stop_ok)(struct device *dev);
};
struct generic_pm_domain {
@@ -62,8 +63,13 @@ struct gpd_link {
struct list_head slave_node;
};
+struct gpd_gov_dev_data {
+ s64 break_even_ns;
+};
+
struct generic_pm_domain_data {
struct pm_domain_data base;
+ struct gpd_gov_dev_data *gov_data;
bool need_restore;
};
@@ -73,8 +79,19 @@ static inline struct generic_pm_domain_d
}
#ifdef CONFIG_PM_GENERIC_DOMAINS
-extern int pm_genpd_add_device(struct generic_pm_domain *genpd,
- struct device *dev);
+extern struct dev_power_governor simple_qos_governor;
+
+extern struct generic_pm_domain *dev_to_genpd(struct device *dev);
+extern int __pm_genpd_add_device(struct generic_pm_domain *genpd,
+ struct device *dev,
+ struct gpd_gov_dev_data *gov_data);
+
+static inline int pm_genpd_add_device(struct generic_pm_domain *genpd,
+ struct device *dev)
+{
+ return __pm_genpd_add_device(genpd, dev, NULL);
+}
+
extern int pm_genpd_remove_device(struct generic_pm_domain *genpd,
struct device *dev);
extern int pm_genpd_add_subdomain(struct generic_pm_domain *genpd,
@@ -83,8 +100,23 @@ extern int pm_genpd_remove_subdomain(str
struct generic_pm_domain *target);
extern void pm_genpd_init(struct generic_pm_domain *genpd,
struct dev_power_governor *gov, bool is_off);
+
extern int pm_genpd_poweron(struct generic_pm_domain *genpd);
+
+extern bool default_stop_ok(struct device *dev);
+
#else
+
+static inline struct generic_pm_domain *dev_to_genpd(struct device *dev)
+{
+ return ERR_PTR(-ENOSYS);
+}
+static inline int __pm_genpd_add_device(struct generic_pm_domain *genpd,
+ struct device *dev,
+ struct gpd_gov_dev_data *gov_data)
+{
+ return -ENOSYS;
+}
static inline int pm_genpd_add_device(struct generic_pm_domain *genpd,
struct device *dev)
{
@@ -105,12 +137,17 @@ static inline int pm_genpd_remove_subdom
{
return -ENOSYS;
}
-static inline void pm_genpd_init(struct generic_pm_domain *genpd,
- struct dev_power_governor *gov, bool is_off) {}
+static inline void pm_genpd_init(struct generic_pm_domain *genpd, bool is_off)
+{
+}
static inline int pm_genpd_poweron(struct generic_pm_domain *genpd)
{
return -ENOSYS;
}
+static inline bool default_stop_ok(struct device *dev)
+{
+ return false;
+}
#endif
#ifdef CONFIG_PM_GENERIC_DOMAINS_RUNTIME
Index: linux/drivers/base/power/domain.c
===================================================================
--- linux.orig/drivers/base/power/domain.c
+++ linux/drivers/base/power/domain.c
@@ -21,7 +21,7 @@ static DEFINE_MUTEX(gpd_list_lock);
#ifdef CONFIG_PM
-static struct generic_pm_domain *dev_to_genpd(struct device *dev)
+struct generic_pm_domain *dev_to_genpd(struct device *dev)
{
if (IS_ERR_OR_NULL(dev->pm_domain))
return ERR_PTR(-EINVAL);
@@ -403,6 +403,22 @@ static void genpd_power_off_work_fn(stru
}
/**
+ * genpd_stop_dev - Stop a given device if that's beneficial.
+ * @genpd: PM domain the device belongs to.
+ * @dev: Device to stop.
+ */
+static int genpd_stop_dev(struct generic_pm_domain *genpd, struct device *dev)
+{
+ bool (*stop_ok)(struct device *dev);
+
+ stop_ok = genpd->gov ? genpd->gov->stop_ok : NULL;
+ if (stop_ok && !stop_ok(dev))
+ return -EBUSY;
+
+ return genpd->stop_device(dev);
+}
+
+/**
* pm_genpd_runtime_suspend - Suspend a device belonging to I/O PM domain.
* @dev: Device to suspend.
*
@@ -423,7 +439,7 @@ static int pm_genpd_runtime_suspend(stru
might_sleep_if(!genpd->dev_irq_safe);
if (genpd->stop_device) {
- int ret = genpd->stop_device(dev);
+ int ret = genpd_stop_dev(genpd, dev);
if (ret)
return ret;
}
@@ -495,7 +511,7 @@ static int pm_genpd_runtime_resume(struc
mutex_lock(&genpd->lock);
}
finish_wait(&genpd->status_wait_queue, &wait);
- __pm_genpd_restore_device(dev->power.subsys_data->domain_data, genpd);
+ __pm_genpd_restore_device(dev_to_psd(dev)->domain_data, genpd);
genpd->resume_count--;
genpd_set_active(genpd);
wake_up_all(&genpd->status_wait_queue);
@@ -1076,11 +1092,13 @@ static void pm_genpd_complete(struct dev
#endif /* CONFIG_PM_SLEEP */
/**
- * pm_genpd_add_device - Add a device to an I/O PM domain.
+ * __pm_genpd_add_device - Add a device to an I/O PM domain.
* @genpd: PM domain to add the device to.
* @dev: Device to be added.
+ * @gov_data: Set of PM QoS parameters to attach to the device.
*/
-int pm_genpd_add_device(struct generic_pm_domain *genpd, struct device *dev)
+int __pm_genpd_add_device(struct generic_pm_domain *genpd, struct device *dev,
+ struct gpd_gov_dev_data *gov_data)
{
struct generic_pm_domain_data *gpd_data;
struct pm_domain_data *pdd;
@@ -1123,6 +1141,7 @@ int pm_genpd_add_device(struct generic_p
gpd_data->base.dev = dev;
gpd_data->need_restore = false;
list_add_tail(&gpd_data->base.list_node, &genpd->dev_list);
+ gpd_data->gov_data = gov_data;
out:
genpd_release_lock(genpd);
Index: linux/drivers/base/power/Makefile
===================================================================
--- linux.orig/drivers/base/power/Makefile
+++ linux/drivers/base/power/Makefile
@@ -3,7 +3,7 @@ obj-$(CONFIG_PM_SLEEP) += main.o wakeup.
obj-$(CONFIG_PM_RUNTIME) += runtime.o
obj-$(CONFIG_PM_TRACE_RTC) += trace.o
obj-$(CONFIG_PM_OPP) += opp.o
-obj-$(CONFIG_PM_GENERIC_DOMAINS) += domain.o
+obj-$(CONFIG_PM_GENERIC_DOMAINS) += domain.o domain_governor.o
obj-$(CONFIG_HAVE_CLK) += clock_ops.o
ccflags-$(CONFIG_DEBUG_DRIVER) := -DDEBUG
Index: linux/drivers/base/power/domain_governor.c
===================================================================
--- /dev/null
+++ linux/drivers/base/power/domain_governor.c
@@ -0,0 +1,40 @@
+/*
+ * drivers/base/power/domain_governor.c - Governors for device PM domains.
+ *
+ * Copyright (C) 2011 Rafael J. Wysocki <rjw@sisk.pl>, Renesas Electronics Corp.
+ *
+ * This file is released under the GPLv2.
+ */
+
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/pm_domain.h>
+#include <linux/pm_qos.h>
+
+bool default_stop_ok(struct device *dev)
+{
+ struct gpd_gov_dev_data *gov_data;
+ s64 constraint_ns;
+ s32 constraint;
+
+ dev_dbg(dev, "%s()\n", __func__);
+
+ gov_data = to_gpd_data(dev_to_psd(dev)->domain_data)->gov_data;
+ if (!gov_data)
+ return true;
+
+ constraint = dev_pm_qos_read_value(dev);
+ if (constraint < 0)
+ return false;
+ else if (constraint == 0) /* 0 means "don't care" */
+ return true;
+
+ constraint_ns = constraint;
+ constraint_ns *= NSEC_PER_USEC;
+
+ return constraint_ns > gov_data->break_even_ns;
+}
+
+struct dev_power_governor simple_qos_governor = {
+ .stop_ok = default_stop_ok,
+};
Index: linux/arch/arm/mach-shmobile/pm-sh7372.c
===================================================================
--- linux.orig/arch/arm/mach-shmobile/pm-sh7372.c
+++ linux/arch/arm/mach-shmobile/pm-sh7372.c
@@ -161,13 +161,15 @@ static bool sh7372_power_down_forbidden(
struct dev_power_governor sh7372_always_on_gov = {
.power_down_ok = sh7372_power_down_forbidden,
+ .stop_ok = default_stop_ok,
};
void sh7372_init_pm_domain(struct sh7372_pm_domain *sh7372_pd)
{
struct generic_pm_domain *genpd = &sh7372_pd->genpd;
+ struct dev_power_governor *gov = sh7372_pd->gov;
- pm_genpd_init(genpd, sh7372_pd->gov, false);
+ pm_genpd_init(genpd, gov ? : &simple_qos_governor, false);
genpd->stop_device = pm_clk_suspend;
genpd->start_device = pm_clk_resume;
genpd->dev_irq_safe = true;
^ permalink raw reply
* [RFC][PATCH 0/2] PM: Generic PM domains and device PM QoS (v2)
From: Rafael J. Wysocki @ 2011-10-21 23:09 UTC (permalink / raw)
To: Linux PM list; +Cc: LKML, Linux-sh list, Jean Pihet, Magnus Damm
Hi,
This patchset is a refresh of patches introducing simple PM QoS governor
functions for PM domains. The patches still haven't been tested properly,
although they should build. The purpose of them is mainly to illustrate
how PM QoS may be used with PM domains to control device runtime PM.
Thanks,
Rafael
^ permalink raw reply
* [U-Boot] [PATCH 2/2] SPL: Allow ARM926EJS to avoid compiling in the CPU support code
From: Albert ARIBAUD @ 2011-10-21 23:08 UTC (permalink / raw)
To: u-boot
In-Reply-To: <201110220046.49651.marek.vasut@gmail.com>
Le 22/10/2011 00:46, Marek Vasut a ?crit :
> On Saturday, October 22, 2011 12:44:06 AM Albert ARIBAUD wrote:
>> Le 22/10/2011 00:00, Marek Vasut a ?crit :
>>> On Friday, October 21, 2011 11:52:23 PM Albert ARIBAUD wrote:
>>>> Hi Marek,
>>>>
>>>> Le 21/10/2011 22:44, Marek Vasut a ?crit :
>>>>> On Thursday, October 06, 2011 02:13:26 AM Marek Vasut wrote:
>>>>>> This allows the SPL to avoid compiling in the CPU support code.
>>>>>>
>>>>>> Signed-off-by: Marek Vasut<marek.vasut@gmail.com>
>>>>>> Cc: Stefano Babic<sbabic@denx.de>
>>>>>> Cc: Wolfgang Denk<wd@denx.de>
>>>>>> Cc: Detlev Zundel<dzu@denx.de>
>>>>>> Cc: Scott Wood<scottwood@freescale.com>
>>>>>> ---
>>>>>>
>>>>>> arch/arm/cpu/arm926ejs/Makefile | 7 +++++++
>>>>>> 1 files changed, 7 insertions(+), 0 deletions(-)
>>>>>>
>>>>>> diff --git a/arch/arm/cpu/arm926ejs/Makefile
>>>>>> b/arch/arm/cpu/arm926ejs/Makefile index 930e0d1..3f9b0f1 100644
>>>>>> --- a/arch/arm/cpu/arm926ejs/Makefile
>>>>>> +++ b/arch/arm/cpu/arm926ejs/Makefile
>>>>>> @@ -28,6 +28,13 @@ LIB = $(obj)lib$(CPU).o
>>>>>>
>>>>>> START = start.o
>>>>>> COBJS = cpu.o
>>>>>>
>>>>>> +ifdef CONFIG_SPL_BUILD
>>>>>> +ifdef CONFIG_SPL_NO_CPU_SUPPORT_CODE
>>>>>> +START :=
>>>>>> +COBJS :=
>>>>>> +endif
>>>>>> +endif
>>>>>> +
>>>>>>
>>>>>> SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
>>>>>> OBJS := $(addprefix $(obj),$(COBJS) $(SOBJS))
>>>>>> START := $(addprefix $(obj),$(START))
>>>>>
>>>>> Hi Albert,
>>>>>
>>>>> can we get this applied please?
>>>>
>>>> I still don't understand what this is supposed to do -- why not linking
>>>> this code is required.
>>>>
>>>> Amicalement,
>>>
>>> Hi Albert,
>>>
>>> I use very different start.S in SPL. And I don't need cpu.o at all.
>>
>> That I understand; but is there a /problem/ in linking cpu.o in?
>
> I suppose it'll be optimized out at link time ?
That indirectly answers my question: what you want to achieve is
removing dead code.
Now, about your question, you can check this if you build the board you
intend to apply this to, and do an objdump of the generated SPL: you'll
see if the cpu.o functions are present or not.
(my point being that if cpu.o is to disappear because its functions are
either useless or should move elsewhere, then the interest of a patch
making cpu.o optional is short-lived.)
> Cheers
Amicalement,
--
Albert.
^ permalink raw reply
* Re: How to free devices held captive by failed arrays
From: Harry Mangalam @ 2011-10-21 23:08 UTC (permalink / raw)
To: NeilBrown, linux-raid
In-Reply-To: <20111022100457.0f5133f3@notabene.brown>
> > > >
> > > >
> > > > What do I have to do to free this device?
> > >
> > > Doesn't
> > >
> > > mdadm --stop /dev/md_d0
> > >
> > > release sdg1 ??
> > >
> > > NeilBrown
> >
> > No, it doesn't.
> >
> > $ mdadm --stop /dev/md_d0
> > mdadm: error opening /dev/md_d0: No such file or directory
> >
> > In fact, that's sort of odd:
> >
> > $ ls -l /dev/md*
> > brw-rw---- 1 root disk 9, 0 2011-10-20 17:18 /dev/md0
> > lrwxrwxrwx 1 root root 7 2011-10-20 17:05 /dev/md_d0p1 -> md/d0p1
> > lrwxrwxrwx 1 root root 7 2011-10-20 17:05 /dev/md_d0p2 -> md/d0p2
> > lrwxrwxrwx 1 root root 7 2011-10-20 17:05 /dev/md_d0p3 -> md/d0p3
> > lrwxrwxrwx 1 root root 7 2011-10-20 17:05 /dev/md_d0p4 -> md/d0p4
> >
> > /dev/md:
> > total 0
> > brw------- 1 root root 254, 0 2011-10-20 17:05 d0
> > brw------- 1 root root 254, 1 2011-10-20 17:05 d0p1
> > brw------- 1 root root 254, 2 2011-10-20 17:05 d0p2
> > brw------- 1 root root 254, 3 2011-10-20 17:05 d0p3
> > brw------- 1 root root 254, 4 2011-10-20 17:05 d0p4
> >
> > [no record of /dev/md_d0] ...?
> >
> > hjm
> >
>
> md_d0 is another name for md/d0. The former probably only gets created when
> the array becomes active.
> So use
> mdadm --stop /dev/md/d0
Perfect! That did it. The other RAID is now initializing.
That goes in the personal HowTos..
Many thanks!
hjm
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.