drm_dp_mst_helper.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625
  1. /*
  2. * Copyright © 2014 Red Hat.
  3. *
  4. * Permission to use, copy, modify, distribute, and sell this software and its
  5. * documentation for any purpose is hereby granted without fee, provided that
  6. * the above copyright notice appear in all copies and that both that copyright
  7. * notice and this permission notice appear in supporting documentation, and
  8. * that the name of the copyright holders not be used in advertising or
  9. * publicity pertaining to distribution of the software without specific,
  10. * written prior permission. The copyright holders make no representations
  11. * about the suitability of this software for any purpose. It is provided "as
  12. * is" without express or implied warranty.
  13. *
  14. * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  15. * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  16. * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  17. * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  18. * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  19. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  20. * OF THIS SOFTWARE.
  21. */
  22. #ifndef _DRM_DP_MST_HELPER_H_
  23. #define _DRM_DP_MST_HELPER_H_
  24. #include <linux/types.h>
  25. #include <drm/drm_dp_helper.h>
  26. #include <drm/drm_atomic.h>
  27. struct drm_dp_mst_branch;
  28. /**
  29. * struct drm_dp_vcpi - Virtual Channel Payload Identifier
  30. * @vcpi: Virtual channel ID.
  31. * @pbn: Payload Bandwidth Number for this channel
  32. * @aligned_pbn: PBN aligned with slot size
  33. * @num_slots: number of slots for this PBN
  34. */
  35. struct drm_dp_vcpi {
  36. int vcpi;
  37. int pbn;
  38. int aligned_pbn;
  39. int num_slots;
  40. };
  41. /**
  42. * struct drm_dp_mst_port - MST port
  43. * @kref: reference count for this port.
  44. * @port_num: port number
  45. * @input: if this port is an input port.
  46. * @mcs: message capability status - DP 1.2 spec.
  47. * @ddps: DisplayPort Device Plug Status - DP 1.2
  48. * @pdt: Peer Device Type
  49. * @ldps: Legacy Device Plug Status
  50. * @dpcd_rev: DPCD revision of device on this port
  51. * @num_sdp_streams: Number of simultaneous streams
  52. * @num_sdp_stream_sinks: Number of stream sinks
  53. * @available_pbn: Available bandwidth for this port.
  54. * @next: link to next port on this branch device
  55. * @mstb: branch device attach below this port
  56. * @aux: i2c aux transport to talk to device connected to this port.
  57. * @parent: branch device parent of this port
  58. * @vcpi: Virtual Channel Payload info for this port.
  59. * @connector: DRM connector this port is connected to.
  60. * @mgr: topology manager this port lives under.
  61. *
  62. * This structure represents an MST port endpoint on a device somewhere
  63. * in the MST topology.
  64. */
  65. struct drm_dp_mst_port {
  66. struct kref kref;
  67. u8 port_num;
  68. bool input;
  69. bool mcs;
  70. bool ddps;
  71. u8 pdt;
  72. bool ldps;
  73. u8 dpcd_rev;
  74. u8 num_sdp_streams;
  75. u8 num_sdp_stream_sinks;
  76. uint16_t available_pbn;
  77. struct list_head next;
  78. struct drm_dp_mst_branch *mstb; /* pointer to an mstb if this port has one */
  79. struct drm_dp_aux aux; /* i2c bus for this port? */
  80. struct drm_dp_mst_branch *parent;
  81. struct drm_dp_vcpi vcpi;
  82. struct drm_connector *connector;
  83. struct drm_dp_mst_topology_mgr *mgr;
  84. /**
  85. * @cached_edid: for DP logical ports - make tiling work by ensuring
  86. * that the EDID for all connectors is read immediately.
  87. */
  88. struct edid *cached_edid;
  89. /**
  90. * @has_audio: Tracks whether the sink connector to this port is
  91. * audio-capable.
  92. */
  93. bool has_audio;
  94. };
  95. /**
  96. * struct drm_dp_mst_branch - MST branch device.
  97. * @kref: reference count for this port.
  98. * @rad: Relative Address to talk to this branch device.
  99. * @lct: Link count total to talk to this branch device.
  100. * @num_ports: number of ports on the branch.
  101. * @msg_slots: one bit per transmitted msg slot.
  102. * @ports: linked list of ports on this branch.
  103. * @port_parent: pointer to the port parent, NULL if toplevel.
  104. * @mgr: topology manager for this branch device.
  105. * @tx_slots: transmission slots for this device.
  106. * @last_seqno: last sequence number used to talk to this.
  107. * @link_address_sent: if a link address message has been sent to this device yet.
  108. * @guid: guid for DP 1.2 branch device. port under this branch can be
  109. * identified by port #.
  110. *
  111. * This structure represents an MST branch device, there is one
  112. * primary branch device at the root, along with any other branches connected
  113. * to downstream port of parent branches.
  114. */
  115. struct drm_dp_mst_branch {
  116. struct kref kref;
  117. u8 rad[8];
  118. u8 lct;
  119. int num_ports;
  120. int msg_slots;
  121. struct list_head ports;
  122. /* list of tx ops queue for this port */
  123. struct drm_dp_mst_port *port_parent;
  124. struct drm_dp_mst_topology_mgr *mgr;
  125. /* slots are protected by mstb->mgr->qlock */
  126. struct drm_dp_sideband_msg_tx *tx_slots[2];
  127. int last_seqno;
  128. bool link_address_sent;
  129. /* global unique identifier to identify branch devices */
  130. u8 guid[16];
  131. };
  132. /* sideband msg header - not bit struct */
  133. struct drm_dp_sideband_msg_hdr {
  134. u8 lct;
  135. u8 lcr;
  136. u8 rad[8];
  137. bool broadcast;
  138. bool path_msg;
  139. u8 msg_len;
  140. bool somt;
  141. bool eomt;
  142. bool seqno;
  143. };
  144. struct drm_dp_nak_reply {
  145. u8 guid[16];
  146. u8 reason;
  147. u8 nak_data;
  148. };
  149. struct drm_dp_link_address_ack_reply {
  150. u8 guid[16];
  151. u8 nports;
  152. struct drm_dp_link_addr_reply_port {
  153. bool input_port;
  154. u8 peer_device_type;
  155. u8 port_number;
  156. bool mcs;
  157. bool ddps;
  158. bool legacy_device_plug_status;
  159. u8 dpcd_revision;
  160. u8 peer_guid[16];
  161. u8 num_sdp_streams;
  162. u8 num_sdp_stream_sinks;
  163. } ports[16];
  164. };
  165. struct drm_dp_remote_dpcd_read_ack_reply {
  166. u8 port_number;
  167. u8 num_bytes;
  168. u8 bytes[255];
  169. };
  170. struct drm_dp_remote_dpcd_write_ack_reply {
  171. u8 port_number;
  172. };
  173. struct drm_dp_remote_dpcd_write_nak_reply {
  174. u8 port_number;
  175. u8 reason;
  176. u8 bytes_written_before_failure;
  177. };
  178. struct drm_dp_remote_i2c_read_ack_reply {
  179. u8 port_number;
  180. u8 num_bytes;
  181. u8 bytes[255];
  182. };
  183. struct drm_dp_remote_i2c_read_nak_reply {
  184. u8 port_number;
  185. u8 nak_reason;
  186. u8 i2c_nak_transaction;
  187. };
  188. struct drm_dp_remote_i2c_write_ack_reply {
  189. u8 port_number;
  190. };
  191. struct drm_dp_sideband_msg_rx {
  192. u8 chunk[48];
  193. u8 msg[256];
  194. u8 curchunk_len;
  195. u8 curchunk_idx; /* chunk we are parsing now */
  196. u8 curchunk_hdrlen;
  197. u8 curlen; /* total length of the msg */
  198. bool have_somt;
  199. bool have_eomt;
  200. struct drm_dp_sideband_msg_hdr initial_hdr;
  201. };
  202. #define DRM_DP_MAX_SDP_STREAMS 16
  203. struct drm_dp_allocate_payload {
  204. u8 port_number;
  205. u8 number_sdp_streams;
  206. u8 vcpi;
  207. u16 pbn;
  208. u8 sdp_stream_sink[DRM_DP_MAX_SDP_STREAMS];
  209. };
  210. struct drm_dp_allocate_payload_ack_reply {
  211. u8 port_number;
  212. u8 vcpi;
  213. u16 allocated_pbn;
  214. };
  215. struct drm_dp_connection_status_notify {
  216. u8 guid[16];
  217. u8 port_number;
  218. bool legacy_device_plug_status;
  219. bool displayport_device_plug_status;
  220. bool message_capability_status;
  221. bool input_port;
  222. u8 peer_device_type;
  223. };
  224. struct drm_dp_remote_dpcd_read {
  225. u8 port_number;
  226. u32 dpcd_address;
  227. u8 num_bytes;
  228. };
  229. struct drm_dp_remote_dpcd_write {
  230. u8 port_number;
  231. u32 dpcd_address;
  232. u8 num_bytes;
  233. u8 *bytes;
  234. };
  235. #define DP_REMOTE_I2C_READ_MAX_TRANSACTIONS 4
  236. struct drm_dp_remote_i2c_read {
  237. u8 num_transactions;
  238. u8 port_number;
  239. struct {
  240. u8 i2c_dev_id;
  241. u8 num_bytes;
  242. u8 *bytes;
  243. u8 no_stop_bit;
  244. u8 i2c_transaction_delay;
  245. } transactions[DP_REMOTE_I2C_READ_MAX_TRANSACTIONS];
  246. u8 read_i2c_device_id;
  247. u8 num_bytes_read;
  248. };
  249. struct drm_dp_remote_i2c_write {
  250. u8 port_number;
  251. u8 write_i2c_device_id;
  252. u8 num_bytes;
  253. u8 *bytes;
  254. };
  255. /* this covers ENUM_RESOURCES, POWER_DOWN_PHY, POWER_UP_PHY */
  256. struct drm_dp_port_number_req {
  257. u8 port_number;
  258. };
  259. struct drm_dp_enum_path_resources_ack_reply {
  260. u8 port_number;
  261. u16 full_payload_bw_number;
  262. u16 avail_payload_bw_number;
  263. };
  264. /* covers POWER_DOWN_PHY, POWER_UP_PHY */
  265. struct drm_dp_port_number_rep {
  266. u8 port_number;
  267. };
  268. struct drm_dp_query_payload {
  269. u8 port_number;
  270. u8 vcpi;
  271. };
  272. struct drm_dp_resource_status_notify {
  273. u8 port_number;
  274. u8 guid[16];
  275. u16 available_pbn;
  276. };
  277. struct drm_dp_query_payload_ack_reply {
  278. u8 port_number;
  279. u8 allocated_pbn;
  280. };
  281. struct drm_dp_sideband_msg_req_body {
  282. u8 req_type;
  283. union ack_req {
  284. struct drm_dp_connection_status_notify conn_stat;
  285. struct drm_dp_port_number_req port_num;
  286. struct drm_dp_resource_status_notify resource_stat;
  287. struct drm_dp_query_payload query_payload;
  288. struct drm_dp_allocate_payload allocate_payload;
  289. struct drm_dp_remote_dpcd_read dpcd_read;
  290. struct drm_dp_remote_dpcd_write dpcd_write;
  291. struct drm_dp_remote_i2c_read i2c_read;
  292. struct drm_dp_remote_i2c_write i2c_write;
  293. } u;
  294. };
  295. struct drm_dp_sideband_msg_reply_body {
  296. u8 reply_type;
  297. u8 req_type;
  298. union ack_replies {
  299. struct drm_dp_nak_reply nak;
  300. struct drm_dp_link_address_ack_reply link_addr;
  301. struct drm_dp_port_number_rep port_number;
  302. struct drm_dp_enum_path_resources_ack_reply path_resources;
  303. struct drm_dp_allocate_payload_ack_reply allocate_payload;
  304. struct drm_dp_query_payload_ack_reply query_payload;
  305. struct drm_dp_remote_dpcd_read_ack_reply remote_dpcd_read_ack;
  306. struct drm_dp_remote_dpcd_write_ack_reply remote_dpcd_write_ack;
  307. struct drm_dp_remote_dpcd_write_nak_reply remote_dpcd_write_nack;
  308. struct drm_dp_remote_i2c_read_ack_reply remote_i2c_read_ack;
  309. struct drm_dp_remote_i2c_read_nak_reply remote_i2c_read_nack;
  310. struct drm_dp_remote_i2c_write_ack_reply remote_i2c_write_ack;
  311. } u;
  312. };
  313. /* msg is queued to be put into a slot */
  314. #define DRM_DP_SIDEBAND_TX_QUEUED 0
  315. /* msg has started transmitting on a slot - still on msgq */
  316. #define DRM_DP_SIDEBAND_TX_START_SEND 1
  317. /* msg has finished transmitting on a slot - removed from msgq only in slot */
  318. #define DRM_DP_SIDEBAND_TX_SENT 2
  319. /* msg has received a response - removed from slot */
  320. #define DRM_DP_SIDEBAND_TX_RX 3
  321. #define DRM_DP_SIDEBAND_TX_TIMEOUT 4
  322. struct drm_dp_sideband_msg_tx {
  323. u8 msg[256];
  324. u8 chunk[48];
  325. u8 cur_offset;
  326. u8 cur_len;
  327. struct drm_dp_mst_branch *dst;
  328. struct list_head next;
  329. int seqno;
  330. int state;
  331. bool path_msg;
  332. struct drm_dp_sideband_msg_reply_body reply;
  333. };
  334. /* sideband msg handler */
  335. struct drm_dp_mst_topology_mgr;
  336. struct drm_dp_mst_topology_cbs {
  337. /* create a connector for a port */
  338. struct drm_connector *(*add_connector)(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port, const char *path);
  339. void (*register_connector)(struct drm_connector *connector);
  340. void (*destroy_connector)(struct drm_dp_mst_topology_mgr *mgr,
  341. struct drm_connector *connector);
  342. void (*hotplug)(struct drm_dp_mst_topology_mgr *mgr);
  343. };
  344. #define DP_MAX_PAYLOAD (sizeof(unsigned long) * 8)
  345. #define DP_PAYLOAD_LOCAL 1
  346. #define DP_PAYLOAD_REMOTE 2
  347. #define DP_PAYLOAD_DELETE_LOCAL 3
  348. struct drm_dp_payload {
  349. int payload_state;
  350. int start_slot;
  351. int num_slots;
  352. int vcpi;
  353. };
  354. struct drm_dp_mst_topology_state {
  355. int avail_slots;
  356. struct drm_atomic_state *state;
  357. struct drm_dp_mst_topology_mgr *mgr;
  358. };
  359. /**
  360. * struct drm_dp_mst_topology_mgr - DisplayPort MST manager
  361. *
  362. * This struct represents the toplevel displayport MST topology manager.
  363. * There should be one instance of this for every MST capable DP connector
  364. * on the GPU.
  365. */
  366. struct drm_dp_mst_topology_mgr {
  367. /**
  368. * @dev: device pointer for adding i2c devices etc.
  369. */
  370. struct drm_device *dev;
  371. /**
  372. * @cbs: callbacks for connector addition and destruction.
  373. */
  374. const struct drm_dp_mst_topology_cbs *cbs;
  375. /**
  376. * @max_dpcd_transaction_bytes: maximum number of bytes to read/write
  377. * in one go.
  378. */
  379. int max_dpcd_transaction_bytes;
  380. /**
  381. * @aux: AUX channel for the DP MST connector this topolgy mgr is
  382. * controlling.
  383. */
  384. struct drm_dp_aux *aux;
  385. /**
  386. * @max_payloads: maximum number of payloads the GPU can generate.
  387. */
  388. int max_payloads;
  389. /**
  390. * @conn_base_id: DRM connector ID this mgr is connected to. Only used
  391. * to build the MST connector path value.
  392. */
  393. int conn_base_id;
  394. /**
  395. * @down_rep_recv: Message receiver state for down replies. This and
  396. * @up_req_recv are only ever access from the work item, which is
  397. * serialised.
  398. */
  399. struct drm_dp_sideband_msg_rx down_rep_recv;
  400. /**
  401. * @up_req_recv: Message receiver state for up requests. This and
  402. * @down_rep_recv are only ever access from the work item, which is
  403. * serialised.
  404. */
  405. struct drm_dp_sideband_msg_rx up_req_recv;
  406. /**
  407. * @lock: protects mst state, primary, dpcd.
  408. */
  409. struct mutex lock;
  410. /**
  411. * @mst_state: If this manager is enabled for an MST capable port. False
  412. * if no MST sink/branch devices is connected.
  413. */
  414. bool mst_state;
  415. /**
  416. * @mst_primary: Pointer to the primary/first branch device.
  417. */
  418. struct drm_dp_mst_branch *mst_primary;
  419. /**
  420. * @dpcd: Cache of DPCD for primary port.
  421. */
  422. u8 dpcd[DP_RECEIVER_CAP_SIZE];
  423. /**
  424. * @sink_count: Sink count from DEVICE_SERVICE_IRQ_VECTOR_ESI0.
  425. */
  426. u8 sink_count;
  427. /**
  428. * @pbn_div: PBN to slots divisor.
  429. */
  430. int pbn_div;
  431. /**
  432. * @state: State information for topology manager
  433. */
  434. struct drm_dp_mst_topology_state *state;
  435. /**
  436. * @funcs: Atomic helper callbacks
  437. */
  438. const struct drm_private_state_funcs *funcs;
  439. /**
  440. * @qlock: protects @tx_msg_downq, the &drm_dp_mst_branch.txslost and
  441. * &drm_dp_sideband_msg_tx.state once they are queued
  442. */
  443. struct mutex qlock;
  444. /**
  445. * @tx_msg_downq: List of pending down replies.
  446. */
  447. struct list_head tx_msg_downq;
  448. /**
  449. * @payload_lock: Protect payload information.
  450. */
  451. struct mutex payload_lock;
  452. /**
  453. * @proposed_vcpis: Array of pointers for the new VCPI allocation. The
  454. * VCPI structure itself is &drm_dp_mst_port.vcpi.
  455. */
  456. struct drm_dp_vcpi **proposed_vcpis;
  457. /**
  458. * @payloads: Array of payloads.
  459. */
  460. struct drm_dp_payload *payloads;
  461. /**
  462. * @payload_mask: Elements of @payloads actually in use. Since
  463. * reallocation of active outputs isn't possible gaps can be created by
  464. * disabling outputs out of order compared to how they've been enabled.
  465. */
  466. unsigned long payload_mask;
  467. /**
  468. * @vcpi_mask: Similar to @payload_mask, but for @proposed_vcpis.
  469. */
  470. unsigned long vcpi_mask;
  471. /**
  472. * @tx_waitq: Wait to queue stall for the tx worker.
  473. */
  474. wait_queue_head_t tx_waitq;
  475. /**
  476. * @work: Probe work.
  477. */
  478. struct work_struct work;
  479. /**
  480. * @tx_work: Sideband transmit worker. This can nest within the main
  481. * @work worker for each transaction @work launches.
  482. */
  483. struct work_struct tx_work;
  484. /**
  485. * @destroy_connector_list: List of to be destroyed connectors.
  486. */
  487. struct list_head destroy_connector_list;
  488. /**
  489. * @destroy_connector_lock: Protects @connector_list.
  490. */
  491. struct mutex destroy_connector_lock;
  492. /**
  493. * @destroy_connector_work: Work item to destroy connectors. Needed to
  494. * avoid locking inversion.
  495. */
  496. struct work_struct destroy_connector_work;
  497. };
  498. int drm_dp_mst_topology_mgr_init(struct drm_dp_mst_topology_mgr *mgr,
  499. struct drm_device *dev, struct drm_dp_aux *aux,
  500. int max_dpcd_transaction_bytes,
  501. int max_payloads, int conn_base_id);
  502. void drm_dp_mst_topology_mgr_destroy(struct drm_dp_mst_topology_mgr *mgr);
  503. int drm_dp_mst_topology_mgr_set_mst(struct drm_dp_mst_topology_mgr *mgr, bool mst_state);
  504. int drm_dp_mst_hpd_irq(struct drm_dp_mst_topology_mgr *mgr, u8 *esi, bool *handled);
  505. enum drm_connector_status drm_dp_mst_detect_port(struct drm_connector *connector, struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port);
  506. bool drm_dp_mst_port_has_audio(struct drm_dp_mst_topology_mgr *mgr,
  507. struct drm_dp_mst_port *port);
  508. struct edid *drm_dp_mst_get_edid(struct drm_connector *connector, struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port);
  509. int drm_dp_calc_pbn_mode(int clock, int bpp);
  510. bool drm_dp_mst_allocate_vcpi(struct drm_dp_mst_topology_mgr *mgr,
  511. struct drm_dp_mst_port *port, int pbn, int slots);
  512. int drm_dp_mst_get_vcpi_slots(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port);
  513. void drm_dp_mst_reset_vcpi_slots(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port);
  514. void drm_dp_mst_deallocate_vcpi(struct drm_dp_mst_topology_mgr *mgr,
  515. struct drm_dp_mst_port *port);
  516. int drm_dp_find_vcpi_slots(struct drm_dp_mst_topology_mgr *mgr,
  517. int pbn);
  518. int drm_dp_update_payload_part1(struct drm_dp_mst_topology_mgr *mgr);
  519. int drm_dp_update_payload_part2(struct drm_dp_mst_topology_mgr *mgr);
  520. int drm_dp_check_act_status(struct drm_dp_mst_topology_mgr *mgr);
  521. void drm_dp_mst_dump_topology(struct seq_file *m,
  522. struct drm_dp_mst_topology_mgr *mgr);
  523. void drm_dp_mst_topology_mgr_suspend(struct drm_dp_mst_topology_mgr *mgr);
  524. int drm_dp_mst_topology_mgr_resume(struct drm_dp_mst_topology_mgr *mgr);
  525. struct drm_dp_mst_topology_state *drm_atomic_get_mst_topology_state(struct drm_atomic_state *state,
  526. struct drm_dp_mst_topology_mgr *mgr);
  527. int drm_dp_atomic_find_vcpi_slots(struct drm_atomic_state *state,
  528. struct drm_dp_mst_topology_mgr *mgr,
  529. struct drm_dp_mst_port *port, int pbn);
  530. int drm_dp_atomic_release_vcpi_slots(struct drm_atomic_state *state,
  531. struct drm_dp_mst_topology_mgr *mgr,
  532. int slots);
  533. #endif